Opening Scenario
You're building a backend system. One piece of it resizes uploaded images — it runs for about 200ms per image, only when a user uploads something. Another piece processes webhook events from Stripe — sporadic, unpredictable, a few hundred per hour most days, thousands per hour during a sale. You could run an EC2 instance for each, but both would be idle 95% of the time. What do you do?
Question Progression
Concept 1: What is a function-as-a-service and why does it change the cost model?
Question If these workloads are idle most of the time, what's the real cost of running a dedicated server for each?
Reasoning
A t3.small instance costs roughly $15/month whether or not it's processing anything. For workloads that run in short bursts, you're paying for uptime, not for work done. The compute cost per actual unit of work is very high.
Answer Lambda…
In the full tutorial
- When to Reach for Lambda
- Interview Follow-Ups