Understand ECS vs EKS, Fargate vs EC2 launch types, and the standard container architecture patterns.
ECS and EKS — Running Containers on AWS
Containers package your application and all its dependencies together so it runs consistently anywhere. ECS and EKS are the two AWS services for running containers at scale.
Teacher Note: Think of a container like a shipping container. A shipping container can carry anything: cars, clothing, electronics. The ship (AWS infrastructure) does not care what is inside — it just transports it. Containers work the same way: they package your application so it runs identically on your laptop, in testing, and in production.
ECS vs EKS — Which to Choose?
| Feature | ECS (Elastic Container Service) | EKS (Elastic Kubernetes Service) |
|---|
| Technology | AWS-native | Kubernetes (open-source standard) |
| Learning curve | Lower — simpler to start | Higher — Kubernetes expertise needed |
| Portability | AWS-specific | Runs on any cloud or on-premises Kubernetes |
| Ecosystem | AWS integrations only | Vast Kubernetes ecosystem (Helm, operators) |
| Best For | Teams starting with containers on AWS | Teams with Kubernetes expertise or multi-cloud |
Fargate vs EC2 Launch Type
| Feature | Fargate | EC2 Launch Type |
|---|
| Server management | None — fully serverless | You manage EC2 instances |
| Cost | Higher per unit — no idle waste | Lower — especially with Reserved Instances |
| GPU support | No | Yes (for ML inference) |
| Spot integration | Yes (Spot Fargate 70% cheaper) | Yes |
| Best For | Variable workloads, getting started | Steady workloads, GPU, cost-optimised at scale |
ECS Key Concepts
- Task Definition: blueprint for your container — image, CPU, memory, environment variables, secrets
- Service: keeps N tasks running, integrates with ALB for load balancing and rolling updates
- Cluster: group of EC2 instances or Fargate capacity
- ECR (Elastic Container Registry): private Docker registry for storing your container images
Exam Tip: The most common exam pattern: ECS Fargate + ALB + ECR. Fargate is serverless (no EC2 to manage), ALB distributes traffic, ECR stores the Docker images. This is the recommended architecture for most new containerised applications on AWS.