Skip to content

Lab 11 · Cost Optimization

Cost · Est. time: 20–25 min · Cost: ✅ Free — this lab is mostly read-only (viewing recommendations) plus a free S3 lifecycle rule.

Goal. Practice the levers from Topic 11: right-sizing recommendations, purchasing-option recommendations, and an S3 lifecycle rule.


Step 1 — Compute Optimizer (right-sizing)

  1. Compute Optimizer → Get started → Opt in. (It analyzes recent utilization; findings appear after it has data — instant if you've run instances for a while.)
  2. Review EC2 / Auto Scaling / EBS / Lambda recommendations — it flags over- and under-provisioned resources and suggests a right-sized option with projected savings.

Point: Compute Optimizer answers "am I paying for capacity I don't use?" — the right-sizing tool.


Step 2 — Savings Plans / RI recommendations

  1. AWS Cost Management → Savings Plans → Recommendations (or Cost Explorer → Recommendations).
  2. See recommended Compute Savings Plan commitments based on your steady usage and the projected discount vs On-Demand.

Point: steady baseline usage → commit with Savings Plans / RIs; the console does the math for you.


Step 3 — An S3 lifecycle rule (storage cost)

  1. S3 → a bucket → Management → Create lifecycle rule archive-old.
  2. Transition current versions to Standard-IA after 30 days, Glacier Flexible Retrieval after 90, and optionally expire after 365.
  3. Save. Objects now move to cheaper classes automatically by age.
aws s3api put-bucket-lifecycle-configuration --bucket <bucket> \
  --lifecycle-configuration '{"Rules":[{"ID":"archive-old","Status":"Enabled","Filter":{},"Transitions":[{"Days":30,"StorageClass":"STANDARD_IA"},{"Days":90,"StorageClass":"GLACIER"}]}]}'

Lifecycle vs Intelligent-Tiering

Use lifecycle when access is predictable by age. If the pattern is unknown/changing, use Intelligent-Tiering instead (it moves objects automatically with no retrieval fees).


Step 4 — Spot & waste checks (concept)

  • For fault-tolerant/interruptible workloads (batch, CI, rendering), a Spot request is up to ~90% cheaper — try EC2 → Spot Requests to see current Spot prices (don't launch unless you'll use it).
  • Quick waste wins: delete unattached EBS volumes, release unassociated Elastic IPs, and remove idle load balancers.

Teardown

Nothing billable was created (the lifecycle rule is free and beneficial — you can keep it). If you made a test bucket just for this, empty and delete it.


✅ What you should understand now

  • Compute Optimizer = right-sizing recommendations from real utilization.
  • Steady usage → Savings Plans / RIs (the console recommends commitments); interruptible → Spot; short/unpredictable → On-Demand.
  • S3 lifecycle transitions data to cheaper classes by age; Intelligent-Tiering handles unknown patterns.
  • Common waste: unattached EBS volumes, unassociated Elastic IPs, idle load balancers.
  • gp3 is cheaper than gp2 for equivalent performance.

Related: Learn — Cost Optimization