Cloud cost optimization
Right-sizing, spot/savings plans, storage tiers, egress traps. Senior roles own the bill.
About 27 min read3-question knowledge check
The mental model
Cloud billing works like a hotel, not like a house. You do not buy the building; you rent rooms by the minute, and every room you forget to check out of keeps charging. Nobody notices, because the bill arrives once a month as one enormous number with no names on it.
Three ideas make the number legible:
- Everything is a meter. Compute per second, storage per GB-month, requests per million, and — the one that bites — data leaving the building per GB. Nobody bills you for luggage coming in. They bill you for luggage going out. That is egress.
- *You pay for what you provision, not what you use.* An EC2 instance at 4% CPU costs the same as one at 90%. A 1 TB EBS volume with 20 GB on it costs 1 TB. That gap — provisioned minus used — is where most of the waste lives.
- Commitment buys discount. Pay-as-you-go is the walk-in rate. Promise a fixed spend for one or three years and you get 30–70% off. Accept that the hotel can evict you with two minutes' notice and you get up to 90% off — that is spot.
The senior-engineer version: cost is a non-functional requirement, like latency. You do not "do a cost project"; you attach a number to every architecture decision and put a budget alarm on it before anything ships.
The full lesson continues with 15 more sections
- 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