EKS vs. ECS: orchestrating containers on AWS

Andreas Wittig – 06 Jun 2018

AWS announced Kubernetes-as-a-Service at re:Invent in November 2017: Elastic Container Service for Kubernetes (EKS). Since yesterday, EKS is generally available. I discussed ECS vs. Kubernetes before EKS was a thing. Therefore, I’d like to take a second attempt and compare EKS with ECS.

Container

Before comparing the differences, let us start with what EKS and ECS have in common. Both solutions are managing containers distributed among a fleet of virtual machines. Managing containers includes:

  • Monitoring and replacing failed containers.
  • Deploying new versions of your containers.
  • Scaling the number of containers based on load.

What are the differences between EKS and ECS?

Load Balancing

Usually, a load balancer is as the entry point into your AWS infrastructure. Both EKS and ECS offer integrations with Elastic Load Balancing (ELB).

On the one hand, Kubernetes - and therefore EKS - offers an integration with the Classic Load Balancer. Support for the Application Load Balancer and Network Load Balancer are available as beta releases. When creating a service Kubernetes does also create or configure a Classic Load Balancer for you.

  1. The client sends a request to ELB.
  2. ELB distributes the request to one of the nodes also known as EC2 instances.
  3. A proxy running on the node is forwarding the request to one of the pods providing the service.

On the other hand, ECS provides an integration with the Application Load Balancer (ALB), the Network Load Balancer (NLB) as well as the Classic Load Balancer (CLB). When using the ALB, the flow for each incoming request needs only two instead of three steps.

  1. The client sends a request to the ALB.
  2. ALB forwards request to one of the tasks providing the service.

The following figure illustrates the difference.

EKS vs. ECS: Load Balancing

The proxy running on each node is distributing requests randomly or based on the round robin algorithm among all pods running in the cluster. Doing so increases the network traffic between EC2 instances and between AZs which consumes network capacity and adds latency.

Cover of Rapid Docker on AWS

Become a Docker on AWS professional!

Our book Rapid Docker on AWS is designed for DevOps engineers and web developers who want to run dockerized web applications on AWS. We lead you with many examples: From dockerizing your application to Continuous Deployment and Infrastructure as Code on AWS. No prior knowledge of Docker and AWS is required. Get the first chapter for free!

In contrast, the tight integration between ECS and ALB does not require a third routing step and is, therefore, more efficient.

VPC and ENI

Being able to integrate containers running on EKS or ECS into your VPC is excellent. Both EKS and ECS allow attaching an Elastic Network Interface (ENI) to containers. However, there is a slight difference between VPC mode with EKS and ECS.

As shown in the following figure EKS is attaching multiple ENIs per instance. Multiple private IP addresses are assigned to each ENI. EKS assigns each pod - a group of containers - a private IP address. However, some pods are sharing network interfaces with each other. That is different with ECS as each task - a group of containers - is assigned to a separate ENI.

EKS vs. ECS: VPC and ENI

The number of ENIs per instance is limited from 2 to 15 depending on the instance type. As EKS is sharing ENIs between pods, you can place up to 750 pods per instance. Much more than the maximum of 15 tasks you can place per instance with ECS.

But sharing ENIs between instances comes with a limitation as well. You are not able to restrict traffic with a security group per pod, as the ENI and therefore the security group is shared with multiple pods.

IAM

ECS supports IAM Roles for Tasks which is great to grant containers access to AWS resources. For example, to allow containers to access S3, DynamoDB, SQS, or SES at runtime. Unfortunately, EKS does not support IAM for pods out-of-the-box at the moment.

Pricing

Each EKS cluster costs you 0.20 USD per hour which is about 144 USD per month. ECS is free. For both, EKS and ECS you have to pay for the underlying EC2 instances and related resources.

Compatibility

EKS offers Kubernetes-as-a-Service for AWS. However, Kubernetes is an option at other cloud providers, on-premises, or even on your developer machine. To put it in other words: Kubernetes offers you a layer of abstraction allowing you to deploy your applications on top of any infrastructure.

Whereas, ECS is only available on AWS.

Summary

As for now, ECS offers a much deeper integration into the AWS infrastructure than EKS. A strong argument for EKS is the possibility to use the same technology at other cloud providers or on-premises.

Want to get started with ECS quickly? Check out our book and online seminar Rapid Docker on AWS.

Andreas Wittig

Andreas Wittig

I’m an independent consultant, technical writer, and programming founder. All these activities have to do with AWS. I’m writing this blog and all other projects together with my brother Michael.

In 2009, we joined the same company as software developers. Three years later, we were looking for a way to deploy our software—an online banking platform—in an agile way. We got excited about the possibilities in the cloud and the DevOps movement. It’s no wonder we ended up migrating the whole infrastructure of Tullius Walden Bank to AWS. This was a first in the finance industry, at least in Germany! Since 2015, we have accelerated the cloud journeys of startups, mid-sized companies, and enterprises. We have penned books like Amazon Web Services in Action and Rapid Docker on AWS, we regularly update our blog, and we are contributing to the Open Source community. Besides running a 2-headed consultancy, we are entrepreneurs building Software-as-a-Service products.

We are available for projects.

You can contact me via Email, Twitter, and LinkedIn.

Briefcase icon
Hire me