The Silent Budget Killer
Cloud bills creep up. You start with a small instance, add a database, enable logging, and before you know it, the monthly invoice looks like a mortgage payment. The good news: most overspending comes from habits, not architecture. Fix the habits, and you cut costs without a major refactor.
I've trimmed my own cloud spend by about 40% using the practices below. They're boring, but they work.
1. Tag Everything, Then Enforce
Tags are not just metadata. They are your cost accounting system. If you can't see which team, project, or environment owns a resource, you can't make decisions about it.
Start with mandatory tags: env, project, owner. Apply them to every resource, including storage buckets and load balancers. Then, enforce with a policy. On AWS, use Service Control Policies or a simple Lambda that stops resources missing tags. On GCP, use Org Policy. On Azure, Azure Policy.
Once tags are in place, generate a cost report by tag. You'll immediately spot the "test" environment that's been running production-sized instances for months.
2. Right-Size, Then Schedule
Most workloads don't need 24/7 compute. Development, staging, and even some production (like internal dashboards) can be shut down at night and on weekends.
First, right-size: look at CPU and memory utilization over the last 30 days. If an instance peaks at 10% CPU, it's too big. Downgrade it. Don't guess; use the metrics.
Then, schedule. Use a simple cron job or a cloud scheduler to stop instances at 7 PM and start them at 7 AM. For example, on AWS:
# Stop instances tagged env=dev at 7 PM UTC
eventbridge rule --schedule "cron(0 19 * * ? *)" --targets "arn:aws:lambda:..."
Or use a managed solution like AWS Instance Scheduler. The savings are immediate: a dev instance running 40 hours a week instead of 168 costs 76% less.
3. Use Spot Instances for Stateless Workloads
Spot instances (or preemptible VMs on GCP) can be 60-90% cheaper than on-demand. The catch: they can be reclaimed. So use them for workloads that tolerate interruption: batch jobs, CI runners, rendering, data processing.
Set up a spot fleet with a mix of instance types. If one type gets reclaimed, another takes over. For CI, this is a no-brainer. Your builds are idempotent anyway.
# docker-compose for CI runner
extension: &spot
type: spot
max-price: 0.05
Just make sure your application handles graceful shutdown. Save state, retry, and move on.
4. Set Budgets and Alerts
You can't manage what you don't measure. Set a monthly budget per project or environment. Most clouds let you create budgets with alert thresholds: 50%, 90%, 100%.
When you get an alert at 90%, you have a few days to act. Don't ignore it. The alert is your friend.
Also, enable anomaly detection. Some tools (like AWS Cost Anomaly Detection) use machine learning to flag unusual spending. A sudden spike in data transfer or storage costs is often a misconfigured resource, not a business surge.
5. Delete Unused Resources
This sounds obvious, but it's the biggest waste I see. Orphaned volumes, old snapshots, unattached IPs, stale load balancers. They all cost money.
Set a monthly reminder to review:
- Unattached EBS volumes (or persistent disks)
- Old snapshots beyond a retention period
- Elastic IPs not associated with an instance
- Load balancers with no targets
Write a script to find them:
aws ec2 describe-volumes --filters "Name=status,Values=available" --query 'Volumes[*].VolumeId'
Then delete or snapshot. Make it a habit, not a one-time cleanup.
6. Use Managed Services Wisely
Managed services (RDS, Cloud SQL, DynamoDB) save engineering time, but they cost more than self-hosted alternatives. That's fine for production. But for low-traffic apps, a small managed database might be overkill.
Consider serverless options: Aurora Serverless, Cloud Spanner, or even SQLite on a tiny instance. For many apps, a single small instance with PostgreSQL is enough and costs $15/month instead of $50 for a managed DB.
Also, pay attention to data transfer costs. Egress is where clouds make money. Keep traffic within the same region and use a CDN for static assets.
7. Review Monthly, Act Weekly
Cost optimization is not a one-time project. It's a habit. Set a recurring calendar event: every Monday, spend 15 minutes checking your cost dashboard.
Look for:
- New resources without tags
- Instances running 24/7 that shouldn't be
- Spike in data transfer
- Any resource that's been idle for 7 days
Make it a team ritual. Share the cost report. When everyone sees the numbers, they start thinking twice before spinning up a 16-core beast for a quick test.
The Payoff
These habits won't make your cloud bill zero, but they'll cut it significantly. The key is consistency. Tag everything, schedule what you can, use spot when possible, and review weekly.
Start with one habit this week. Tag all resources. Next week, add a schedule. The savings compound. Your future self (and your finance team) will thank you.
Top comments (0)