ECS vs EKS vs Fargate vs Lambda
These four names get mixed up on exam day because they are not four equal choices. Amazon ECS and Amazon EKS are container orchestrators. AWS Fargate is serverless capacity that runs containers for either of them, and the alternative is Amazon EC2 instances you manage yourself. AWS Lambda is different again: you give it code, not a container to keep running.
So the questions you will see are usually "requirement, then pick": run Kubernetes, avoid servers, finish in under 15 minutes, keep a long-running service alive. This page gives you the decision table first, then the side-by-side facts, the traps, and a drill to practise on.
Reviewed against the AWS documentation
At a glance
Amazon ECS
A fully managed container orchestration service from AWS. You describe your app in a task definition and run it as a service or a one-off task.
- Containers with the least orchestration overhead on AWS
- Long-running stateless services and batch tasks
- Teams that do not need Kubernetes
Amazon EKS
A managed Kubernetes service. AWS runs the Kubernetes control plane, and you run pods on EC2 nodes, Fargate, or EKS Auto Mode.
- You need Kubernetes APIs, tooling, or portability
- Existing Kubernetes workloads moving to AWS
- Hybrid setups with your own data center
AWS Fargate
Serverless compute for containers. It is not an orchestrator: you use it as the capacity behind ECS tasks or EKS pods, so there are no servers to manage.
- Containers without managing EC2 instances
- Variable or unpredictable workloads
- Getting started with containers quickly
AWS Lambda
Serverless compute that runs your code in response to events or requests. AWS handles servers, patching, capacity, and scaling.
- Event-driven work and short tasks
- APIs and automation with spiky traffic
- No server or cluster management at all
Which one does the question want?
| If the question says | Pick | Why |
|---|---|---|
| Run Docker containers on AWS with the simplest AWS-native orchestration, and no Kubernetes requirement | ECS | ECS is the fully managed AWS container orchestrator. Task definitions, services, and scaling are built in, with no control plane to run. Docs |
| The team already uses Kubernetes, kubectl, and Helm, and wants the same tools on AWS | EKS | EKS is managed Kubernetes. AWS runs the control plane while you keep the Kubernetes APIs and tooling. Docs |
| Run containers but do not provision, patch, or scale EC2 instances | Fargate | Fargate removes the need to provision, configure, or scale clusters of virtual machines. You pick it as the capacity for ECS or EKS. Docs |
| Run a short piece of code when a file lands in S3 or a message arrives, with no servers | Lambda | Lambda runs code in response to events from services such as S3, SQS, and EventBridge, and scales automatically. Docs |
| A job that runs for several hours in one go | Fargate | A Lambda invocation is capped at 15 minutes by default. A container task on Fargate (under ECS or EKS) is not bound by that limit. Docs |
| Interruption-tolerant container tasks at a lower cost, still with no servers to manage | Fargate | Fargate Spot runs tasks on spare capacity at a discount. Tasks get a two-minute warning when AWS needs the capacity back. Docs |
| GPUs, privileged containers, or a custom AMI for your containers on ECS | ECS | ECS on EC2 instances covers specialized hardware, privileged capabilities, and custom AMIs. Fargate does not support GPUs or privileged containers. Docs |
| Spiky traffic that can drop to zero, with the least operational work | Lambda | Lambda is pay-per-use and creates and removes execution environments as traffic changes, so there is nothing to size or keep running. Docs |
Side by side
Exam traps
Treating Fargate as a rival to ECS or EKS
Fargate is the serverless capacity you run ECS tasks or EKS pods on. If an option says "Fargate instead of ECS", it is likely a distractor. The real contrast is Fargate versus EC2 instances as capacity.
AWS docsPicking Lambda for work that runs longer than 15 minutes
Lambda has a default maximum of 15 minutes per invocation. When a question describes a long job or a long-running service, look at containers on ECS or EKS with Fargate instead.
AWS docsChoosing EKS when nothing mentions Kubernetes
EKS is the answer when the requirement says Kubernetes, existing Kubernetes tooling, or Kubernetes portability. For plain "run containers on AWS", ECS is the simpler AWS-native fit.
AWS docsAssuming Fargate can do everything EC2 can
Fargate does not support GPUs or privileged containers. If the scenario needs GPUs, privileged access, or a custom AMI, the capacity must be EC2 instances.
AWS docsForgetting that Lambda sync payloads are small
Synchronous Lambda requests and responses are limited to 6 MB each. Large payloads belong in S3 (pass a reference) or on a container service.
AWS docs
Practice it
Frequently Asked Questions
What is the difference between ECS and Fargate?
ECS is the orchestrator that decides what runs and keeps it healthy. Fargate is one of the capacity options ECS can use, alongside EC2 instances and ECS Managed Instances. So "ECS vs Fargate" is really "which capacity should ECS use": Fargate if you want no servers to manage, EC2 if you need control over instances.
ECS vs EKS: which one should I choose?
Choose EKS when you need Kubernetes, for example existing manifests, Kubernetes tooling, or hybrid nodes in your own data center. Choose ECS when you just want to run containers on AWS with built-in AWS integrations and no Kubernetes to learn. Both can use Fargate.
Fargate vs Lambda: how do I decide?
Lambda suits short, event-driven code, with a default limit of 15 minutes per invocation. Fargate suits containerized apps that run longer, need a custom container environment, or stay up as a service. If the question says "container" and "no servers", think Fargate. If it says "function" or "event", think Lambda.
Lambda vs EC2: when is Lambda the better fit?
Lambda fits spiky or event-driven work because AWS manages servers, patching, and scaling, and you pay per request and execution time. EC2 gives you full control of the instance, which matters for long-running processes or custom setups. On the exam, "least operational overhead" usually points to Lambda or Fargate over EC2.
Can I run Kubernetes on Fargate?
Yes. Amazon EKS can schedule pods on Fargate using Fargate profiles. Some things are not supported there, such as DaemonSets, privileged containers, GPUs, and Fargate Spot.