Compute and containers
Choosing between EC2, Lambda, ECS, EKS, Fargate and Elastic Beanstalk, plus ECS network modes, Lambda concurrency and VPC access, and edge compute.
Exam tasks: 2.5 (select compute for performance and scale), 4.3 (choose new architectures: serverless, containers)
The decision: how much of the platform do you want to manage (servers, clusters, runtimes), and what does the workload need that only a lower level gives you (long runtimes, GPUs, special kernels, Kubernetes APIs)?
Choosing a platform
Side by side
| EC2 | Lambda | ECS or EKS on Fargate | ECS or EKS on EC2 | Elastic Beanstalk | |
|---|---|---|---|---|---|
| You manage | OS, patching, scaling | Code only | Task or pod definitions | Cluster nodes too | App code, some config |
| Max run time | Unlimited | 15 minutes | Unlimited | Unlimited | Unlimited |
| Scale to zero | No (ASG can hit 0) | Yes | Yes (0 tasks) | Tasks yes, nodes via scaling | No |
| GPUs | Yes | No | No | Yes | Yes, via instance type |
| Pricing | Per instance-second | Per request + GB-second | Per vCPU and GB-second | Per instance | Underlying resources |
| Best when | Legacy apps, licensing, full control | Spiky, event-driven work | Containers without servers | Dense packing, special hardware | Lift a web app with little change |
Exam signal
"Least operational overhead" plus containers means Fargate. "Must use existing Kubernetes manifests and Helm charts" means EKS. "Runs for hours" or "needs a GPU" rules out Lambda (and Fargate for GPUs).
Legacy: use Amazon ECS Express Mode instead
AWS App Runner stopped accepting new customers on April 30, 2026. It still runs for existing users, but new designs that want "container image in, HTTPS URL out" use ECS Express Mode, which provisions the ALB, scaling and domain for an ECS service from an image and two IAM roles.
Dedicated service pages
- AWS Lambda: invocation models, concurrency, VPC networking and limits.
- Containers on AWS: ECS, EKS, Fargate, ECR and task networking.
- Amazon CloudFront: Functions and Lambda@Edge at the edge.
Service discovery and mesh
- AWS Cloud Map is a registry for service names and endpoints. ECS and EKS services register instances, and
clients resolve them through DNS or the
DiscoverInstancesAPI. It also gives health-checked results. - ECS Service Connect adds a managed proxy and short names for services in the same cluster or namespace, with retries and metrics, and no mesh to run.
- VPC Lattice connects services across VPCs and accounts with auth policies, and works for EC2, ECS, EKS and Lambda.
Legacy: use ECS Service Connect or VPC Lattice instead
AWS App Mesh reached end of support on September 30, 2026. If a question offers App Mesh for a new design, choose Service Connect for ECS or VPC Lattice instead.
Scenarios
awsvpc gives every task its own ENI, so a security group can identify the payments tasks specifically. Host ports in bridge mode are dynamic and shared on the instance's security group, so they can't reliably isolate one service. Host mode has the same shared-security-group problem. One service per instance works but wastes capacity and adds operational overhead.
Provisioned concurrency keeps environments initialized for the peak, removing cold starts. Reserved concurrency on the batch function caps how much of the Regional pool it can take. More memory speeds up execution but doesn't eliminate cold starts or throttling. A VPC adds nothing here. A longer timeout doesn't affect cold starts or concurrency.
Both tasks only read and write headers and URLs, which CloudFront Functions handles at edge locations with sub-millisecond runtime and the lowest per-request cost. Lambda@Edge works but costs more and adds latency. API Gateway or an ALB-backed Lambda would add a hop in front of or behind the cache without any benefit.
Related
- Load balancers: Fronting ECS, EKS and Lambda.
- Hybrid and edge compute: The same services on Outposts.
- Modernization: Moving to containers and serverless.
- AWS Lambda and Containers on AWS: the dedicated service pages.
Further reading
Decoupling with queues, topics and events
When to use SQS, SNS, EventBridge, Step Functions, Kinesis Data Streams, Amazon MQ or MSK to break a system into independent parts.
AWS Lambda
Invocation models, event source mappings, concurrency, versions and aliases, VPC networking, packaging and the limits the exam asks about.