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
AWS docs

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 docs

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 docs

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
AWS docs

Which one does the question want?

If the question saysPickWhy
Run Docker containers on AWS with the simplest AWS-native orchestration, and no Kubernetes requirementECSECS 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 AWSEKSEKS 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 instancesFargateFargate 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 serversLambdaLambda 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 goFargateA 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 manageFargateFargate 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 ECSECSECS 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 workLambdaLambda 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

AspectECSEKSFargateLambda
What you manage No control plane to run. You choose the capacity: Fargate, EC2 instances, or ECS Managed InstancesAWS manages the Kubernetes control plane. With EKS Auto Mode it manages the nodes tooNo servers or clusters. You set task CPU and memory, networking, and IAMNo servers at all. AWS handles maintenance, capacity, scaling, and patching
What you deploy A container image described by a task definition, run as a service or taskKubernetes pods and manifestsThe same containers or pods as ECS or EKS, since Fargate is the capacity underneathFunction code (zip archive or container image) with a handler
Where it runs Fargate, EC2 instances, ECS Managed Instances, or on-premises with ECS AnywhereEC2 nodes, Fargate, EKS Auto Mode, or hybrid nodes in your own data centerBehind ECS tasks or EKS pods (Fargate profiles in EKS)AWS-managed execution environments, with no capacity to choose
Scaling Service Auto Scaling changes the desired number of tasks. Cluster Auto Scaling handles EC2 capacityStandard Kubernetes scaling, such as the Horizontal Pod AutoscalerYou do not scale a cluster of VMs. Tasks or pods scale through ECS or EKSAutomatic, one execution environment per concurrent request, up to your concurrency limit
Pricing model Depends on the capacity option you chooseA per-cluster EKS charge, plus the EC2 instances, Fargate, or other resources your workloads usePay-as-you-go for the CPU and memory your tasks or pods use. Fargate Spot (ECS only) is discountedPer request plus GB-seconds of execution time
Maximum run time No time limit. A service is long running, and a task does its work and then stopsNo time limit. Pods run until they finish, are stopped, or are rescheduledNo time limit like Lambda has. AWS can retire tasks or pods for patching, so plan for restarts15 minutes per invocation by default
Size limits exams like Depends on the capacity. EC2 instance types allow GPUs and specialized hardwareFull range of EC2 instance types on nodesTask size up to 32 vCPU. Fargate has no GPU supportMemory 128 MB to 10,240 MB, CPU scales with memory. Synchronous payload 6 MB
Fargate restrictions to remember On Fargate: no privileged containers, no GPU, tasks always use awsvpc networkingOn Fargate: no DaemonSets, no privileged containers, no GPUs, no Fargate Spot, private subnets onlyNo custom AMIs and no node to SSH into: there is no host operating system for you to manageNot applicable
Upgrade chores No Kubernetes versions to trackEach Kubernetes minor version gets 14 months of standard support, then 12 months of extended support at extra costAWS patches the platform. New tasks start on the latest platform version revisionAWS patches the runtime and infrastructure for you
Typical use Long-running stateless services and batch jobs in containersKubernetes workloads in AWS, and hybrid setups with your own data centerVariable or unpredictable container workloads with no servers to manageEvent-driven work, APIs, data processing, automation

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 docs
  • Picking 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 docs
  • Choosing 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 docs
  • Assuming 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 docs
  • Forgetting 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.