Infrastructure Cost Optimization: AWS, GCP, and Azure Spending Analysis

Your Cloud Bill Is Probably 30-40% Too High

That's not a guess. Gartner's research consistently shows that organizations waste 30-35% of their cloud spending. Flexera's annual State of the Cloud report puts it even higher. The reasons are predictable: oversized instances, forgotten dev environments running 24/7, unused elastic IPs, and storage volumes attached to nothing.

I've done cost optimization for teams spending anywhere from $5,000 to $500,000 per month. The same patterns show up everywhere.

The Low-Hanging Fruit: What to Check First

Right-Sizing Instances

Most instances are oversized because someone chose a size during initial setup and never revisited it. AWS Cost Explorer has a right-sizing recommendations feature that analyzes CPU and memory utilization over the past 14 days. Cloudwatch Container Insights does the same for ECS tasks and EKS pods.

The numbers are usually striking. I've seen teams running m5.2xlarge instances (8 vCPU, 32 GB) at 12% average CPU utilization. Dropping to m5.large (2 vCPU, 8 GB) saves $150/month per instance — and with 20 instances, that's $36,000/year.

Don't just look at averages though. Check p95 and p99 utilization. An instance averaging 15% CPU that spikes to 90% during batch jobs isn't a good candidate for downsizing — it's a candidate for autoscaling.

Unused Resources

AWS Trusted Advisor flags these, but here's a quick audit checklist:

  • EBS volumes in "available" state (not attached to any instance) — you're paying for storage nobody's using
  • Elastic IPs not associated with running instances — $3.65/month each, adds up fast
  • Old EBS snapshots and AMIs — set lifecycle policies to auto-delete after 90 days
  • Idle load balancers with zero registered targets
  • RDS instances in non-production accounts running 24/7 — these should be on a schedule
# Find unattached EBS volumes
aws ec2 describe-volumes   --filters "Name=status,Values=available"   --query "Volumes[*].{ID:VolumeId,Size:Size,Created:CreateTime}"   --output table

# Find unused Elastic IPs
aws ec2 describe-addresses   --query "Addresses[?AssociationId==null].{IP:PublicIp,AllocId:AllocationId}"   --output table

Dev/Staging Environment Scheduling

Your development database doesn't need to run from 11 PM to 7 AM. It definitely doesn't need to run on weekends.

AWS Instance Scheduler or a simple Lambda function can start and stop non-production resources on a schedule. Typical savings: 65-70% on dev/staging compute costs.

# Tag-based scheduling with AWS Instance Scheduler
# Resources tagged with Schedule=office-hours
# Run Mon-Fri 8AM-8PM in your timezone

Reserved Instances and Savings Plans

If you're running any workload 24/7 on on-demand pricing, you're paying a premium for flexibility you're not using.

AWS Savings Plans offer up to 72% discount for a 3-year commitment, 66% for 1-year. The commitment is to a dollar amount per hour, not specific instance types — so you retain flexibility to change instance families within a commitment.

Compute Savings Plans cover EC2, Fargate, and Lambda. EC2 Instance Savings Plans are locked to a specific instance family in a region but offer slightly deeper discounts.

My recommendation for most teams:

  • Cover your baseline steady-state workload with 1-year Compute Savings Plans (the sweet spot for discount vs. flexibility)
  • Use on-demand for variable workloads that scale with traffic
  • Use Spot for fault-tolerant batch processing, CI/CD, and dev workloads

Don't buy 3-year commitments unless your workload is extremely predictable. Cloud infrastructure changes too fast — what you're running today might be refactored, replatformed, or shut down before a 3-year term ends.

Spot Instances for Cost-Tolerant Workloads

Spot pricing offers 60-90% discounts in exchange for the possibility of interruption. AWS can reclaim Spot instances with 2 minutes' notice.

Good Spot candidates:

  • CI/CD build agents (use the interruption handler to reschedule on another instance)
  • Batch data processing with checkpointing
  • Development and testing environments
  • Stateless web servers behind autoscaling groups (mixed with on-demand for baseline capacity)

The trick is diversifying across multiple instance types and availability zones. Spot prices vary independently per instance type per AZ. If you only bid on m5.large in us-east-1a, you're competing with everyone else who had the same idea.

Storage Cost Optimization

S3 storage tiers are where I see the most money left on the table. Teams store everything in S3 Standard because it's the default, even though 80% of objects are rarely accessed after the first week.

S3 Intelligent-Tiering automates this for $0.0025 per 1,000 objects monitored. For most workloads, it pays for itself many times over by moving cold data to Infrequent Access automatically.

For data you know is cold, lifecycle policies are more predictable:

{
  "Rules": [{
    "ID": "archive-old-logs",
    "Status": "Enabled",
    "Filter": {"Prefix": "logs/"},
    "Transitions": [
      {"Days": 30, "StorageClass": "STANDARD_IA"},
      {"Days": 90, "StorageClass": "GLACIER_IR"},
      {"Days": 365, "StorageClass": "DEEP_ARCHIVE"}
    ],
    "Expiration": {"Days": 2555}
  }]
}

GCP and Azure Quick Wins

The same principles apply across providers:

GCP: Committed Use Discounts (CUDs) are the equivalent of Reserved Instances — 1 or 3-year commitment for 37-57% off. Preemptible VMs are Spot equivalents with a 24-hour maximum lifetime. The Recommender API provides right-sizing suggestions.

Azure: Reserved VM Instances offer similar discounts. Azure Advisor flags idle resources. Azure Spot VMs work like AWS Spot. The cost management portal's anomaly detection catches unexpected spending spikes early.

Building a Cost Culture

Tools don't fix spending problems — culture does. Tag everything with team, environment, and project. Send weekly cost reports to team leads. Make cost a metric in architecture reviews, not just performance and reliability.

The teams that keep cloud costs under control aren't the ones with the best tooling. They're the ones where engineers actually look at the bill.