Serverless vs containers
Lambda (cold starts, 15-min cap, concurrency limits) vs Fargate vs EKS — decision by traffic shape, team maturity, and cost curve, not fashion.
The mental model
Think of two ways to move people around a city. Serverless is Uber: you request a ride when you need one, pay per trip, and the moment you step out the car is gone and costs you nothing. You never own, park, insure or maintain a vehicle. But every ride starts with a wait for the car to arrive, there is a surge price when everyone wants one at once, and you cannot bolt a roof rack on or drive it to a place Uber does not serve.
Containers are a company car you keep parked outside. It is ready the instant you turn the key — no wait — and you can modify it however you like. But you pay for it whether it moves or not, you handle the parking and the servicing, and when demand spikes you have to have bought enough cars in advance.
The whole serverless-versus-containers decision is that tradeoff: pay-per-request with a startup delay, versus pay-for-idle with instant readiness. Everything else is detail.
Why the choice exists at all: compute is a spectrum of how much of the stack AWS manages for you. At one end you rent a bare EC2 instance and own everything above the hypervisor. Lambda sits at the far other end — you hand AWS a function and it owns the OS, the runtime scaling, the patching and the capacity. Fargate is in between: you hand it a container and it owns the host, but you still own the container image and its lifecycle. EKS and ECS-on-EC2 pull back toward you owning the nodes. The engineering question is never "which is best" — it is "how much operational surface do I want to own, given this workload's traffic shape, my team's maturity, and where the cost curve crosses".
- Deep dive
- Internal architecture
- Real-world use cases
- Best practices
- Common mistakes
- Performance
- Security
- Production troubleshooting
- Advantages & disadvantages
- Alternatives
- Interview expectations
- Interview questions
- Facts to remember
- Cheat sheet
- Quick revision