Lesson 8 of 30
AWS bills for what's provisioned and what's used, not for what's intended — a misconfigured loop, an unbounded query, or an idle-but-running resource all cost real money whether or not anyone meant for them to.
12 min read
Every option explains itself — why the right one is right, and why each wrong one is wrong. Miss one and it comes back later on a spaced-repetition schedule.
Question 1 of 3
A feature runs occasionally (a few times a day) as a Lambda function versus running the same amount on an always-on EC2 instance. Which costs less, and why?
Hints without spoilers, and a plain explanation of why a wrong answer was wrong — answered only from this lesson. Free account, no card.
Sign up freeWhat interviewers actually ask about this, and what a strong answer has to cover.
A strong answer covers
Likely follow-ups
Almost every AWS service bills on some combination of three axes: provisioned capacity (an EC2 instance running, whether busy or idle), actual usage (a Lambda invocation, a gigabyte scanned by a query), and data transfer (moving data out of AWS to the internet, which costs money in a way moving it in usually doesn't). Understanding which axis a service bills on is what predicts whether a design choice is going to be cheap or expensive at scale — before the bill arrives, not after.
A "resize this image on upload" feature:
Neither is universally right — this is the same tradeoff from this track's compute-options lesson, just viewed through cost specifically instead of operational control: spiky, infrequent usage favors the pay-per-use model; constant, high, predictable usage favors paying for fixed capacity, because at high enough sustained volume, per-invocation pricing adds up past what a fixed instance would have cost.
"How would you estimate the cost of this architecture before building it?" is a real systems-thinking question, and the strong answer identifies which billing axis each component sits on (provisioned vs. per-use vs. data transfer) and reasons about traffic shape — rather than treating cost as something to find out only after the bill arrives.