EC2 is a virtual server, but AWS provides many higher-level compute services. Choose based on how much infrastructure you want to manage.
Lambda
Lambda is serverless function compute. You upload function code and run it in response to events.
AWS manages:
- Server provisioning
- Scaling
- Runtime environment
- Availability
- Millisecond billing
Typical triggers:
- API Gateway
- S3 events
- SQS
- EventBridge
The main limitation is a maximum execution time of 15 minutes.
Containers and Orchestration
Containers package applications with dependencies, runtime, and configuration so they run consistently.
Orchestration manages container lifecycle: start, stop, scale, recovery, and rolling updates.
ECS
ECS is AWS's native container orchestration service.
ECS on EC2: you manage the underlying EC2 instances and get more control.
ECS on Fargate: no server management; focus on container tasks.
EKS
EKS is managed Kubernetes.
EKS on EC2: for teams needing Kubernetes plus infrastructure control.
EKS on Fargate: for teams wanting Kubernetes without managing nodes.
ECR
ECR is a container image registry for storing, managing, and pulling images.
Fargate
Fargate is a serverless compute engine for containers. It is not an orchestrator; it is the managed compute layer used with ECS or EKS.
Other Compute Services
Elastic Beanstalk: upload code and let AWS handle deployment, scaling, load balancing, and health checks.
AWS Batch: run batch workloads, such as scientific computing, transcoding, or massively parallel processing.
Lightsail: lightweight VPS with predictable pricing for small sites, blogs, learning, and test environments.
Outposts: extends AWS infrastructure to on-premises locations for low latency, data residency, or compliance.
Selection guide:
- Event-driven functions: Lambda
- Containers without servers: ECS/EKS + Fargate
- Kubernetes ecosystem: EKS
- Simple web app deployment: Elastic Beanstalk
- Batch jobs: AWS Batch
- Small VPS: Lightsail
- Hybrid local AWS: Outposts