Topic 7.4
Cost Optimization & Disaster Recovery
In one line
Controlling cost means visibility (tags, budgets, Cost Explorer), right-sizing, and buying compute the right way; resilience means choosing a disaster-recovery strategy by RTO and RPO — and actually testing it.
Think of it like this
Household finances. TAGS and COST EXPLORER are the bank statement split by category; BUDGETS are the alert when groceries exceed the monthly plan; SAVINGS PLANS are the annual metro pass that's cheaper than daily tickets if you commute every day; SPOT is standby airline seats — very cheap, but you might get bumped.
Key ideas
- 01
VISIBILITY first: enforce COST ALLOCATION TAGS (
team,service,env) and activate them in billing; use Cost Explorer to see spend by service and tag; set AWS BUDGETS with alerts per account/team; enable Cost Anomaly Detection to catch spikes like a runaway NAT gateway or a forgotten GPU instance. - 02
The usual big wins: RIGHT-SIZE instances and databases (Compute Optimizer recommendations), switch to GRAVITON, turn off non-prod outside working hours, delete idle resources (unattached EBS volumes, old snapshots, idle load balancers, unused Elastic IPs), fix data transfer — NAT gateway and cross-AZ traffic are frequent hidden costs (Phase 3) — and set log retention and S3 lifecycle rules (Phases 4, 6).
- 03
PURCHASE OPTIONS: SAVINGS PLANS (commit to $/hour for 1 or 3 years; Compute Savings Plans apply across EC2, Fargate, and Lambda — up to ~66% off) or RESERVED INSTANCES (for RDS, ElastiCache, and similar) for the steady baseline; SPOT for fault-tolerant work like batch jobs, CI runners, and stateless workers; ON-DEMAND for the rest.
- 04
DISASTER RECOVERY is sized by two numbers: RTO (how long you can be down) and RPO (how much data you can lose). Strategies, cheapest to fastest: BACKUP & RESTORE (hours; restore from cross-region backups), PILOT LIGHT (core data replicated, compute off until needed), WARM STANDBY (a scaled-down full copy running), MULTI-SITE ACTIVE/ACTIVE (full capacity in two regions).
- 05
Multi-AZ (every phase so far) handles data-center failures; multi-region DR handles regional outages and is much more expensive and complex. Whatever you choose, TEST IT with game days or AWS Fault Injection Service — an untested DR plan is a hope, not a plan. The AWS WELL-ARCHITECTED FRAMEWORK (six pillars: operational excellence, security, reliability, performance efficiency, cost optimization, sustainability) is the checklist to review designs against.
Code & diagrams
# Monthly budget with an alert at 80% of forecast
aws budgets create-budget --account-id 123456789012 --budget '{
"BudgetName": "prod-monthly", "BudgetLimit": {"Amount": "5000", "Unit": "USD"},
"TimeUnit": "MONTHLY", "BudgetType": "COST"
}' --notifications-with-subscribers '[{
"Notification": {"NotificationType": "FORECASTED", "ComparisonOperator": "GREATER_THAN", "Threshold": 80},
"Subscribers": [{"SubscriptionType": "EMAIL", "Address": "finops@example.com"}]
}]'
# Last month's cost by service
aws ce get-cost-and-usage --time-period Start=2026-08-01,End=2026-09-01 \
--granularity MONTHLY --metrics UnblendedCost \
--group-by Type=DIMENSION,Key=SERVICE
# Waste hunt: unattached EBS volumes and unassociated Elastic IPs
aws ec2 describe-volumes --filters Name=status,Values=available \
--query 'Volumes[].[VolumeId,Size,CreateTime]' --output table
aws ec2 describe-addresses --query 'Addresses[?AssociationId==null].[PublicIp,AllocationId]' --output tableLeft to right: cost goes up, RTO/RPO go down.
Explain it without notes
Explain RTO and RPO with an example, and why they drive the choice of DR strategy.
Why are Savings Plans usually a better first purchase than Reserved Instances for compute?
Practice
Your AWS bill jumped 40% this month with no new features. Describe how you'd find the cause.
A B2B SaaS needs RTO 1 hour and RPO 5 minutes for a regional outage. Propose a DR design on AWS.
Trade-offs
- ↔
Every cost optimization trades against something — Spot against interruption, Savings Plans against flexibility, smaller instances against headroom, single NAT gateways against resilience. Likewise, each step up the DR ladder buys lower RTO/RPO at a real, recurring cost; the right point is where the cost of downtime exceeds the cost of prevention.
Done when you can
I tag resources for cost allocation and have budgets with alerts.
I know the common hidden costs: NAT, cross-AZ traffic, logs, idle resources.
I can choose between On-Demand, Savings Plans, Reserved Instances, and Spot.
I can define RTO/RPO and pick and test a matching DR strategy.