ENES

Amazon ECS and Fargate

AWS runs your containers; with Fargate you never see the servers at all.

On the left containers sitting on servers you manage, on the right the same containers floating on a cloud with no servers

Amazon ECS (Elastic container Service) is the AWS service that runs containers for you. You write a task definition: which container image to use, how much CPU and memory it needs, which ports it opens, which environment variables it gets. Then you create a service: 'keep three copies of this task running behind this load balancer', and ECS makes sure three are always alive, replacing any that die.

Where do those containers physically run? Two options. With the EC2 launch type you keep a fleet of Amazon EC2 instances and ECS places tasks on them; you patch and size the machines. With Fargate there is no machine to manage: you say 'this task needs 1 vCPU and 2 GB', AWS finds the capacity, starts the container and bills you per second while it runs.

Example: a Python API packaged as a Docker image and pushed to Amazon ECR, the AWS image registry. An ECS service on Fargate runs two copies in private subnets of a VPC with a load balancer in front; autoscaling adds copies when CPU stays above 70%. Shipping a new version means pushing a new image tag and letting ECS roll it out copy by copy.

ECS is the simpler, AWS-native way to run containers. Amazon EKS is the choice when a team already works with Kubernetes and wants to keep that toolset.

Keep in mind

Go deeper

Related terms

More in AWS