Reducing Cloud Costs on AWS by 30%
Cloud bills are the silent killers of SaaS margins. Recently, we audited a client’s infrastructure and found they were paying for capacity they never used. Here is how we trimmed their monthly AWS bill by 30% without sacrificing performance.
The Serverless Trap
Lambda functions are great, but cold starts and poor memory configuration can rack up costs. We found our client was allocating 1024MB of memory to functions that only needed 128MB. By profiling the execution with AWS Compute Optimizer, we right-sized the functions. We also switched their heavy, long-running computation tasks to ECS Fargate Spot instances, which are significantly cheaper than prolonged Lambda execution times.
Database Indexing is Non-Negotiable
It sounds basic, but 80% of the latency (and cost) came from unoptimized SQL queries scanning full tables in RDS. The application was reading millions of rows to find a single shipment record. By implementing proper composite indexes on the ‘shipment_id’ and ‘date’ columns, we reduced IOPS significantly. This allowed us to downgrade the RDS instance size, saving hundreds of dollars a month.
Zombie Resources
We found 20+ unattached EBS volumes and snapshots from old development environments that were just sitting there, accruing storage costs. We implemented a simple script using the AWS SDK to tag and auto-delete unattached resources older than 7 days.