11 · Compute & Storage Cost Optimization — Revise¶
Cost · 20% · Compressed recall. Read the Learn guide first.
EC2 purchasing¶
| Model | Commit | Discount | Best for |
|---|---|---|---|
| On-Demand | none | 0 | Short/spiky/unpredictable |
| Reserved (RI) | 1/3 yr | up to ~72% | Steady, always-on baseline |
| Savings Plans | 1/3 yr ($/hr) | up to ~72% | Steady + flexibility |
| Spot | none (interruptible) | up to ~90% | Fault-tolerant, stateless, batch |
| Dedicated Host/Instance | opt | most $ | Licensing/compliance only |
RI vs SP: Standard RI = biggest but rigid; Convertible RI = flexible family, less discount. Compute Savings Plan = most flexible (any family/Region/OS + Fargate + Lambda); EC2 Instance SP = family-locked, bigger discount.
Predictable always-on? → RI / Savings Plan
Interruptible batch? → Spot (2-min warning)
Short / unpredictable? → On-Demand
Flexibility + savings? → Compute Savings Plan
Mixed workload? → baseline on RI/SP + burst On-Demand/Spot
Storage cost¶
| Lever | Use |
|---|---|
| S3 lifecycle | Transition/expire by age (predictable) |
| S3 Intelligent-Tiering | Unknown/changing access (no retrieval fee) |
| gp3 over gp2 | Cheaper for same perf |
| Delete unattached EBS / unassociated EIP | Remove waste |
| Compute Optimizer | Right-sizing recommendations |
| S3 Storage Lens | Storage cost visibility |
Flashcards¶
Steady 24/7 for a year — cheapest?
Reserved Instances or a Savings Plan (1/3-yr commitment).Fault-tolerant batch, cheapest compute?
Spot Instances (up to ~90% off; 2-min interruption notice).Commitment savings but flexible across families/Regions + Fargate/Lambda?
Compute Savings Plan.Predictable-by-age data lifecycle vs unknown pattern?
Predictable → S3 lifecycle transitions. Unknown → Intelligent-Tiering.Right-size EC2/EBS/Lambda by utilization?
AWS Compute Optimizer.Is Spot safe for stateful production?
No — it can be reclaimed anytime. Only fault-tolerant/stateless work.gp2 or gp3 for cost?
gp3 — cheaper for equivalent performance.Common traps¶
- Steady → RI/SP; interruptible → Spot; short → On-Demand. Mix for mixed workloads.
- Spot up to 90% off but reclaimable (2 min).
- Compute Savings Plan = most flexible; Standard RI = biggest but rigid.
- Lifecycle (predictable) vs Intelligent-Tiering (unknown).
- gp3 < gp2 cost; delete unattached volumes / EIPs.
- Dedicated Hosts are NOT a cost play (licensing/compliance).