I worked at AWS for years. I have delivered countless services, seen architectures that would make a grown engineer weep, and I know exactly where the bodies are buried in the billing dashboard. What I am about to tell you will 100% help you ace your system design interview and land that 6-figure job.
The Contenders
Let’s break down the usual suspects.
EC2 (Elastic Compute Cloud)
EC2 is only useful if you need full OS and hardware customization. Case in point, if you are running Gen AI models or doing hyper-computing stuff that requires specific kernel flags. But let’s be real: you probably aren't. If you pick EC2, you have to manage everything yourself. You set up the patching window in SSM (System Manager), you handle the updates, and even though Auto Scaling Groups exist, scaling is never actually "easy." The worst part? It is expensive. Even without traffic, you are paying for it. If it goes down at 2 AM? That’s on you. You are responsible for the downtime.
Lambda
Lambda, on the other hand, is mostly perfect. Let AWS engineers wake up in the night for you 😈. No more server anxiety. It’s highly scalable and well-integrated with the AWS ecosystem. The only time you should not use it is if you need a crazy amount of hardware resources or have a long-running duration (15min) (though I usually just add an AWS Step Function to tackle the long-running duration). It does have a little cold-start issue, but there are lots of workarounds. No biggie.
Fargate
If you have a long-running process and you are in the container environment, Fargate is your option. It’s pretty pricey, but with the container, you can exec in to debug, which is pretty nice compared to Lambda's "print and pray" debugging in the CloudWatch.
EKS (Kubernetes)
For the K8s cult followers. They are useful when you like to have full control and have already set up all the scripts like Helm, Flux, ArgoCD, and a blood sacrifice to the YAML gods. Hosting Gen AI is pretty good on EKS these days, but yet again... pretty pricey.
The Meat of the Post 🥩
I’m about to tell you, as an AWS veteran, why 90% of the time you should use Lambda.
EC2? Trust me, you don’t need that. Lambda is more scalable.
Now, the K8s lovers will scream: "Worried! What if I use Lambda and then I’m locked into the service and AWS?"
False. As long as you designed your code architecture properly, there is essentially an entry point—a handler. Just swap the handler out for an Express server or a Go main function if you move to EC2 or K8s later. No worries.
People like K8s because they think they can just "migrate to a different provider" seamlessly. But in the real world, it is still painful to migrate. If migration is going to be painful regardless, why not pick the cheaper one right now?
The EC2 lover will say: "One day I will have a lot of users, and at that scale, Lambda will be too expensive."
True. But I don’t know when that day will come. All I know is that you are paying a lot more right now for that idle EC2 instance. Even if that day comes, just migrate then. It’s really not as much work as you think to wrap your business logic in a container.
The Scenario (A.K.A. The Reality Check):
Traffic: 10,000 requests per day (Pretty decent for a side hustle you'll abandon in 3 months).
Compute: ~512MB memory equivalent.
Duration: 200ms per request.
1. The "I Miss My Server" Option: EC2
You need this running 24/7 because you don't know when users will hit your API. You also need a Load Balancer because you aren't a savage running a single instance exposed to the internet.
Instance: one
t3.nano(the absolute smallest) = ~$3.00/mo.Load Balancer (ALB): This is the hidden killer = ~$16.00/mo.
Total Monthly Cost: ~$19.00 / month
2. The "I Have a YAML Addiction" Option: EKS
You want Kubernetes. Fine. But first, you have to pay the "Cool Tax" just to turn it on.
EKS Control Plane: You pay $72.00/month just to have a cluster exist. Before you run a single pod.
Worker Node: You still need compute. Let's say one EC2
t3.small= ~$15.00/mo.Load Balancer: Still need it = ~$16.00/mo.
Total Monthly Cost: ~$103.00 / month
3. The "I Want Containers But Am Too Lazy for K8s" Option: Fargate (ECS)
Fargate runs your containers without managing servers. It's nice, but it doesn't scale to zero for a web API. It has to keep running (optional you can still keep it short-live), waiting for a request.
Compute (0.25 vCPU, 0.5GB RAM): Running 24/7 = ~$9.00/mo.
Load Balancer: Yep, still need it = ~$16.00/mo.
Total Monthly Cost: ~$25.00 / month
4. The "I Like Money" Option: Lambda
You only pay when users actually visit. If nobody visits your app, Jeff Bezos gets nothing.
Requests: 10,000 * 30 = 300,000 requests/month.
Compute: 300,000 * 0.2s @ 512MB.
Total Monthly Cost: $0.00 (The Free Tier covers tons of this).
Even if you exhaust the Free Tier: It would be less than $0.50 / month.
Final Verdict: Do you want to pay $100+ to feel smart with Kubernetes, $25 to feel moderately modern with Fargate, or $0 with Lambda?
Stop over-engineering. Use Lambda and remember what the Joker said, maybe click that button and buy me a coffee?☕️🃏


Comments
Post a Comment