Reducing AWS Costs by 40% Through System Optimization
Real-world cloud cost optimization strategies applied to a production AWS environment-without sacrificing performance or reliability.
Problem
Cloud infrastructure costs were growing faster than revenue. A mid-sized SaaS platform was spending $45K/month on AWS with no clear ceiling. Costs had doubled over 12 months without a corresponding increase in traffic.
Goal: Reduce monthly AWS spend by 30–40% without degrading system performance or reliability.
System Constraints
- Production system: 99.9% uptime requirement
- No full re-architecture-incremental changes only
- Team size: 4 engineers, 2-week optimization sprints
- Existing stack: ECS Fargate, RDS PostgreSQL, S3, CloudFront, SQS, Lambda
Root Cause Analysis
Before cutting costs, we measured. AWS Cost Explorer + CloudWatch revealed:
| Service | % of Bill | Waste Category |
|---|---|---|
| RDS (Multi-AZ) | 38% | Over-provisioned instance class |
| ECS Fargate | 29% | Always-on dev/staging environments |
| Data Transfer | 14% | Cross-AZ traffic not colocated |
| EC2 (legacy) | 11% | Zombie instances from old deployments |
| Everything else | 8% | - |
Optimizations Applied
1. RDS Right-Sizing
The RDS instance was a db.r5.2xlarge running at 12% average CPU with 30% memory utilization. Downsizing to db.r5.large and enabling RDS Proxy for connection pooling:
- Saved $1,800/month
- No latency impact (monitored via CloudWatch RDS metrics for 2 weeks post-change)
2. ECS Fargate Scheduling for Non-Production
Dev and staging environments ran 24/7. A Lambda function triggered by EventBridge now scales them to zero outside business hours (Mon–Fri, 7am–7pm AEST):
- Saved $3,200/month
- Zero developer workflow disruption
3. S3 Intelligent-Tiering
Large buckets containing infrequently accessed assets (logs, backups, old uploads) were moved to S3 Intelligent-Tiering:
- Saved $900/month
- No application code changes required
4. Reserved Instances for Production Workloads
Converted production ECS and RDS resources from on-demand to 1-year Reserved Instances:
- Saved $4,100/month (34% discount on committed capacity)
5. Colocation of Services
Cross-AZ data transfer was generating unexpected costs. Services in the same logical cluster were migrated into the same AZ where possible:
- Saved $800/month
6. Terminate Zombie EC2 Instances
11 EC2 instances from a previous deployment architecture were still running and had no active traffic. Terminated after confirming no dependencies:
- Saved $1,400/month
Results
| Metric | Before | After |
|---|---|---|
| Monthly AWS spend | $45,200 | $27,100 |
| Cost reduction | - | 40% ($18,100/month) |
| System uptime | 99.91% | 99.94% |
| P99 API latency | 185ms | 178ms |
Annual savings: ~$217,000
Trade-offs
- Reserved Instances reduce flexibility (1-year commitment)
- Dev environment scheduling adds 1–2 minute startup latency for engineers
- RDS right-sizing requires careful monitoring for 2–4 weeks post-change
→ Related: Scaling Backend Systems for High Concurrency → Related: System Design Trade-offs Every Engineer Should Understand