ECS vs EKS vs Fargate
AWS for Interviews: lesson 9 of 18
Pick an orchestrator, then pick how much of the host you want to own.
Lesson 9 of 18 · 6 min
ECS vs EKS vs Fargate
Step 1 of 10
It is two questions, not one: who orchestrates the containers, and what compute they run on.
The Idea
It is two choices. The orchestrator: ECS, AWS's own, with task definitions, services and clusters, or EKS, which runs the Kubernetes control plane for you. The compute: EC2 capacity you choose, patch and scale, or Fargate — serverless compute for both, where each task or pod runs in its own isolation boundary.
Real-World Example
A four-person team shipping a stateless API on AWS picks ECS on Fargate: nobody patches a host. A platform team already running Kubernetes picks EKS to keep its manifests and tooling. A GPU inference service needs EC2 capacity, because Fargate does not offer GPUs.
The Tradeoff
Fargate trades host-level control for less to operate. EKS brings the whole Kubernetes ecosystem, and its operational depth; ECS is simpler but AWS-specific. Fargate tasks use the awsvpc network mode, so each task gets its own network interface.
Hands-On
# illustrative — cluster, subnets and security group are placeholders
aws ecs create-service --cluster prod --service-name api \
--task-definition api:7 --desired-count 3 --launch-type FARGATE \
--network-configuration \
"awsvpcConfiguration={subnets=[subnet-a,subnet-b],securityGroups=[sg-api]}"
Your turn
Put the steps in the right order.
- Create a service with launch type FARGATE and a desired count
- Register a task definition that uses the awsvpc network mode
- Build the image and push it to a registry
- ECS keeps the desired count running, replacing tasks that stop
Mini quiz
1 / 3
AWS Fargate can run containers for:
Sources
- Choosing an AWS container service — AWS Decision Guide
- What is Amazon ECS? — Amazon ECS Developer Guide
- Task definition differences for Fargate — Amazon ECS Developer Guide
- Simplify compute management with AWS Fargate — Amazon EKS User Guide