AWS Database Cost Optimization: A Right-Sizing Framework That Works
A step-by-step framework to cut AWS database and compute costs safely: find idle resources, right-size with percentiles, pick storage and pricing, and automate.
Cloud cost work succeeds when it is systematic and safe: find waste, change one thing at a time, and verify performance. A structured right-sizing program across EC2, RDS and EBS delivered about $1.2M in annualized savings. This framework shows how to repeat that approach in your environment.
1. Get visibility first
- Enforce cost allocation tags (team, service, environment, owner) so every dollar has an owner.
- Use Cost Explorer or the Cost and Usage Report to rank spend by service, account and tag.
- Start with the top 10 line items. Savings follow the Pareto rule.
2. Hunt the obvious waste
- Idle databases: instances with near-zero connections and low CPU for weeks. Snapshot, then stop or delete after owner approval.
- Unattached EBS volumes and orphaned snapshots from deleted instances.
- Old manual snapshots kept forever. Apply a retention policy.
- Non-production running 24/7. Stop dev and test databases outside working hours. RDS can be stopped for a limited number of days at a time, so schedule the restart.
- Over-provisioned storage and IOPS bought "just in case".
A quick way to list unattached EBS volumes in a Region (review before deleting anything):
aws ec2 describe-volumes --filters Name=status,Values=available --query 'Volumes[].[VolumeId,Size,VolumeType,CreateTime]' --output table
3. Right-size using percentiles, not averages
Averages hide spikes and make everything look oversized. Look at at least two to four weeks of CloudWatch metrics and use p95 or p99:
CPUUtilization,FreeableMemory, swap, andDatabaseConnections.- Read/write IOPS and throughput versus provisioned limits.
- Replica lag and latency, so you notice if a smaller instance hurts.
Keep headroom for growth and failover (a standby must carry the full load). Drop one instance size at a time, in a maintenance window, and watch the metrics for a week before the next step.
4. Pick the right storage
- gp3 over gp2 for most workloads: it is generally cheaper per GB and lets you tune IOPS and throughput independently of size. Confirm for your volume sizes.
- Use provisioned-IOPS volumes only where metrics prove you need them.
- Delete data you do not need, and archive cold data (for example to S3) instead of paying for premium database storage.
5. Choose cheaper compute where safe
- Graviton-based instance classes often give better price-performance. Test on your engine version and workload first.
- Consolidate lightly used databases only when isolation and blast radius allow it.
- Review replicas: each one costs a full instance. Remove those that nobody reads from.
6. Commit only after you right-size
Buy commitments after shrinking, otherwise you lock in waste. EC2 and some compute services can use Savings Plans; for RDS, Reserved Instances are the usual commitment tool (Savings Plans do not cover RDS, so verify against current AWS documentation). Cover your steady baseline, not your peak.
7. Automate and keep it from creeping back
- A weekly report of idle resources and top savings candidates sent to owners.
- Scheduled stop/start for non-production.
- Budgets and anomaly alerts on spend.
- Guardrails in Terraform modules: sensible defaults for size, storage type and retention.
8. Measure and report
Track savings as annualized run-rate (monthly saving times 12) and keep a before/after table for every change, including the performance metrics you verified. That evidence builds trust with engineering teams and finance, and makes the next round easier.
Checklist
- Tag everything; rank spend.
- Remove idle and orphaned resources.
- Right-size with p95/p99 and headroom, one step at a time.
- gp3 and Graviton where proven safe.
- Commit after optimizing.
- Automate reports, schedules and budgets.
Enjoyed this?
I write about PostgreSQL, AWS and database reliability. Have a question or a similar problem to solve?