1. EC2: The "Brick and Mortar"
Use Case: Legacy apps, specialized OS requirements, or 24/7 steady-state workloads where you need the absolute lowest unit cost.
- Cost: Cheapest for high-utilization (80%+) steady workloads, but most expensive in "human time" (maintenance).
- Scaling: Slowest. You have to wait for the VM to boot and the agent to initialize.
🎯 Interview Tip: Mention EC2 when the application is not "cloud-native" or requires specific kernel-level tuning that containers can't provide.
2. ECS: The "Efficient Factory"
Use Case: Microservices on AWS where you want "Docker made easy." It’s the AWS-native way to run containers without the overhead of Kubernetes.
- Cost: Balanced. No control plane charge (unlike EKS).
- Scaling: Faster than EC2. Ideal for web APIs and background workers.
🎯 Interview Tip: Recommend ECS for teams that want to move fast on AWS without needing multi-cloud portability. Use Fargate to remove server management entirely.
3. EKS: The "Universal Operating System"
Use Case: Large-scale enterprise systems, hybrid-cloud requirements, or when you already have a heavy investment in the Kubernetes ecosystem.
- Cost: Includes a $0.10/hour cluster fee. Can be expensive for small setups but scales efficiently for massive fleets.
🎯 Interview Tip: Highlight EKS for portability. If the company wants to run the same setup on-prem or on another cloud, EKS is the only choice.
4. Lambda: The "Electric Switch"
Use Case: Event-driven tasks (S3 uploads, DynamoDB streams), small APIs, or "glue code."
- Cost: Cheapest for low/variable traffic. Warning: At high, constant volume, Lambda becomes significantly more expensive than EC2 or ECS.
- Scaling: The gold standard. Scales to thousands of concurrent executions in milliseconds.
🎯 Interview Tip: Use Lambda when traffic is unpredictable or bursty. If nobody uses the app at 3 AM, you pay $0.
How to Answer the "Confusing" Scenarios:
- ECS vs. EKS: "Use ECS if you want a simple, AWS-integrated container experience. Use EKS if you need the specific features of the Kubernetes API or multi-cloud flexibility."
- Lambda vs. Containers: "Use Lambda if the task is short-lived (< 15 mins) and event-driven. Use Containers (ECS/EKS) for long-running processes, WebSockets, or when you need consistent sub-millisecond local caching."