Are you grappling with deciding which container management service to use in the AWS cloud? Do you need to build microservices and complex architectures? Do you need to manage containers, or do you want to run containers without managing servers? If so, this blog is for you.
At nClouds, we are on a mission to deliver innovation faster, and containers can help you to accelerate your time to market. Sometimes selecting which container management service to use in the cloud can be a harder choice than actually containerizing your application on AWS. Of course, I’m exaggerating, but this is the most common question we hear from our customers.
In this blog, we’ll share the pros and cons of running workloads on Amazon ECS, AWS Fargate, and Amazon EKS to help you make that decision more easily.
Note: While there are other ways to run containers on AWS — like installing Kubernetes and Rancher (which schedules services to specific hosts) on Amazon EC2 instances — we believe that running a scheduler overcomplicates the infrastructure and only makes sense for certain types of workloads.
So, let’s get started.
A lot of companies running modern applications use Docker containers to build microservices and complex architectures, or to increase the reliability and availability of their applications. Many tools and frameworks help companies automate the deployment, scalability, and monitoring of their containers and help them build more reliable software. So, how do you decide which container management service to use on AWS — Amazon ECS, AWS Fargate, or Amazon EKS?
Let’s take a look at each of them.
What is Amazon ECS?
Amazon Elastic Container Service (Amazon ECS) is a fast, highly scalable, high-performance service that manages Docker container orchestration using the compute capabilities of Amazon.
Some of Amazon ECS’ characteristics are the following:
- Orchestrates Docker containers as a service.
- Supports Docker Compose.
- Integrates with other Amazon services (IAM, security groups, Amazon CloudWatch Logs, VPCs, etc).
- Allows you to manage the infrastructure behind the containers with an EC2 Launch Type model.
- Uses Amazon ECS task definitions to describe the containers to run inside the cluster.
How Amazon ECS works:
Source: https://aws.amazon.com/ecs/ accessed 3/4/19
Amazon ECS architecture example:
Source: https://aws.amazon.com/ecs/getting-started/ accessed 3/4/19
The architecture example above shows an application running two services (A and B). It has an API Gateway that receives the request from the users and sends them to a load balancer.
The load balancer sends the request to the corresponding service that is running inside containers monitored by AWS Auto Scaling and Amazon ECS. Amazon ECS ensures that the containers are healthy and replaces them when needed, using Docker images stored on Amazon ECR.
What is AWS Fargate?
Fargate is AWS’ containers as a service. It is a serverless compute engine that complements Amazon ECS.
- Run containerized applications on AWS without the need to manage servers or clusters.
- No need to provision, configure, or scale the resources where the containers are running.
AWS Fargate is one of the two ECS launch types available. You don’t need to determine the placement of resources or do the scheduling, scaling, and patching. Just indicate the memory and CPU parameters, the network and roles that Fargate needs to assume, and which application it needs to run. Fargate takes it from there and handles the provisioning and configuration.
How AWS Fargate works
Source: https://aws.amazon.com/fargate/ accessed 3/5/19
Fargate architecture example:
https://docs.aws.amazon.com/AmazonECS/latest/developerguide/launch_types.html accessed 3/5/19
The above architecture example shows different tasks running in two different ECS services using AWS Fargate launch type with the following configuration:
- The tasks are spread across two different Availability Zones in the same AWS Region.
- Each service instantiates containers using ECS task definitions.
- The Fargate tasks pull the Docker images (defined in the ECS task definitions) from Amazon ECR or Docker Hub.
- Each Fargate instance owns a unique Elastic Network Interface that provides it with an IP address to be able to communicate with the network.
What is Amazon EKS?
Amazon Elastic Container Service for Kubernetes (Amazon EKS) is Amazon’s Kubernetes as a service. It allows you to deploy, manage and scale containers using Kubernetes and Amazon’s cloud infrastructure. Amazon EKS runs infrastructure management using three different availability zones, to increase reliability and eliminate a single point of failure.
Some of EKS’ characteristics are the following:
- Manages the availability and scalability of the Kubernetes nodes.
- Integrates with AWS network and security services.
- Automatically detects and replaces unhealthy nodes.
- Monitors container status.
How Amazon EKS works
Source: https://aws.amazon.com/eks/ accessed 3/4/19
EKS architecture example:
https://aws.amazon.com/getting-started/projects/deploy-kubernetes-app-amazon-eks/ accessed 3/4/19
The above architecture example shows an application running inside an EKS cluster with the following configuration:
- Kubectl is used to manage the EKS cluster.
- The Amazon EKS control plane connects to the worker nodes where the containers are running.
- Users connect to a load balancer when they want to use the application.
- The load balancer forwards the request to one of the worker nodes.
Differences between Amazon ECS, AWS Fargate, and Amazon EKS:
|Amazon ECS||AWS Fargate||Amazon EKS|
|Free Amazon service||Pay for the amount of memory and vCPU used by the containers||Fee of $0.10 per cluster per hour, around $72 per cluster per month|
Where it runs
|Only available on AWS||Only available on AWS as part of Amazon ECS||Runs based on Kubernetes and can be migrated in and out of AWS anytime|
|Migrating an application to Amazon ECS requires more work than to Amazon EKS||Requires more work than EKS migration, but it’s easier to configure and deploy than the usual EC2 launch type on ECS.||Easy migration from on-premises to AWS cloud.|
Ease of use
|Learning curve of Amazon ECS architecture is lower than that of Amazon EKS||Same learning curve as Amazon ECS, but easier to deploy and manage||More complex to use and deploy containers.|
What it supports
|Supports AWS Management Console, to access and manage AWS through a simple and intuitive web user interface (WUI)||Supports AWS Management Console, as ECS does||Supports Kubernetes plugins integration|
|Windows containers compatibility||Limited compatibility with some Amazon services (e.g., you can’t attach persistent storage to Fargate)||Every configuration needs to be done using kubectl|
AWS provides three different solutions to run containerized applications in the cloud. Each of them has distinct advantages and suits different purposes:
- If you already have your containers running on Kubernetes or want an advanced orchestration solution with more compatibility, you should use Amazon EKS.
- When you’re looking for a solution that combines simplicity and availability, and you want to have advanced control over your infrastructure, then ECS is the right choice for you. You can create highly available and scalable applications with a few clicks, and you can have the management options that you want.
- Finally, if your application needs something simple without the need to manage local persistent storage (e.g., APIs or microservices) and you want to save some money (paying just for what you use without losing scalability and availability), we suggest that you go with AWS Fargate.
Need help with containers on AWS? The nClouds team is here to help with that and all your AWS infrastructure requirements.