
hywards - Fotolia
Amazon ECS vs. Kubernetes: Which should you use on AWS?
How can you approach container orchestration on AWS? Learn the basics about ECS, EKS, DIY Kubernetes and Fargate before you choose an application architecture for your workloads.
IT teams have several options for running containerized applications on AWS. Some organizations will opt for Kubernetes, the de facto choice for container orchestration, while others will want to use AWS' proprietary orchestration service instead.
IT teams also have the choice of controlling the underlying virtual machines themselves or leaving those management tasks to Amazon. Deciding which approach to take will depend on several factors, so let's explore your options for deploying containers on AWS.
Ways to deploy containers on AWS
There are four main deployment strategies for containerized applications on AWS.
- Kubernetes on Amazon EC2. If you want to run Kubernetes on AWS without using Amazon's managed container services, you create the necessary Amazon EC2 instances, then install a Kubernetes distribution of your choosing. With this approach, Amazon provides only the virtual machines to host your Kubernetes nodes. Users are responsible for provisioning the VMs, along with setting up and managing Kubernetes.
- Amazon Elastic Kubernetes Service (EKS) on Amazon EC2. With Amazon EKS, a managed Kubernetes service, Amazon provides both a Kubernetes management plane and infrastructure to host your cluster. With this option, you don't need to set up Kubernetes, install management or monitoring tools or provision your own nodes. You will, however, still need to perform some management tasks, such as upgrading to newer versions of Kubernetes when available.
- Amazon Elastic Container Service (ECS) on Amazon EC2. Amazon ECS is similar to EKS, but it relies on a proprietary control plane instead of Kubernetes. You are responsible for provisioning the host infrastructure, but ECS handles container orchestration.
- AWS Fargate. AWS handles infrastructure provisioning and management of Fargate, whether you're using ECS or EKS. You simply load your containers and run them -- or you can configure the conditions that should trigger them to run.
ECS vs. Kubernetes
To decide which approach is best, you first need to choose whether you want to use ECS or Kubernetes.
ECS integrates better with other Amazon cloud services because it's native to the platform. But you can't extend it into other clouds or move hosted workloads directly to another location, except for an on-premises installation of AWS Outposts. Still, containers are fairly portable, so it doesn't require a tremendous effort to move to a different platform.
In contrast, Kubernetes is an open source platform that is available on all of the major public clouds and can also run on premises beyond AWS' software. There is also a large and dynamic ecosystem surrounding Kubernetes. With Kubernetes, you can take advantage of a variety of add-ons and extensions. These extra features are not available from ECS.
EKS vs. Kubernetes
If you choose to run Kubernetes on AWS, EKS is probably the best approach in most cases. EKS is much easier to set up and reduces the management burden considerably. EKS can also run on Outposts, in case you need any workloads on premises.
That said, users have more control if they run generic Kubernetes on EC2 instances; they can pick whichever Kubernetes distribution and tooling they wish. With EKS, users are limited to the configurations and tooling built into the platform.
AWS Fargate vs. Amazon EC2
If you decide to use one of AWS' managed container services, you'll need to choose between Fargate and EC2.
In general, cost is the main factor to consider here. Fargate pricing is generally higher, but you only pay for the time that your containers actually run. With EC2, you pay whenever your instances are turned on, even if they are not hosting any active workloads.
Thus, Fargate will likely be more cost-effective if you have containers that run sporadically or experience unpredictable periods of high demand. EC2 is a better option for predictable, consistent workloads.
ECS or EKS on EC2 also requires somewhat more management on users' part because they are responsible for at least some infrastructure management. With Fargate, AWS fully manages the host servers.