DEV Community

AlpeshKumbhare
AlpeshKumbhare

Posted on

AWS Cost Optimization Playbook: 20 Strategies That Actually Save Money in Production

Industry data consistently shows 28-50% of cloud spend is avoidable. Not because teams are careless, but because cost optimization is a continuous discipline — not a one-time project. Resources get provisioned for peak load and never scaled down, default storage classes persist long after access patterns change, and commitment coverage drifts as workloads evolve.

This playbook covers 20 cost optimization strategies organized by impact area, with specific AWS services and actionable implementation steps for each.

The Cost Optimization Stack

┌─────────────────────────────────────────────────────────────────┐
│  Layer 1: VISIBILITY (you can't optimize what you can't see)     │
│  Cost Explorer | CUR | Budgets | Tags | Cost Anomaly Detection  │
├─────────────────────────────────────────────────────────────────┤
│  Layer 2: PRICING MODELS (biggest single lever)                  │
│  Savings Plans | Reserved Instances | Spot | Graviton            │
├─────────────────────────────────────────────────────────────────┤
│  Layer 3: RIGHTSIZING (match resources to actual demand)          │
│  Compute Optimizer | Trusted Advisor | Auto Scaling              │
├─────────────────────────────────────────────────────────────────┤
│  Layer 4: ARCHITECTURE (design for cost efficiency)              │
│  Serverless | Storage tiering | Data transfer | Caching          │
├─────────────────────────────────────────────────────────────────┤
│  Layer 5: GOVERNANCE (sustain savings over time)                  │
│  FinOps practices | Automation | Accountability                  │
└─────────────────────────────────────────────────────────────────┘
Enter fullscreen mode Exit fullscreen mode

Layer 1: Visibility — Know Where the Money Goes

Strategy 1: Enforce Cost Allocation Tags

Without tags, you can't attribute spend to teams, projects, or environments. This is the foundation.

Mandatory tags:

  • Environment (prod/staging/dev)
  • Team or CostCenter
  • Project or Application
  • Owner (email of responsible person)

Enforce with: AWS Config rule required-tags + SCP that denies resource creation without mandatory tags.

Strategy 2: Enable Cost and Usage Reports (CUR)

Cost Explorer gives you summaries. CUR gives you line-item detail (every API call, every hour, every resource). Export CUR to S3 and query with Athena for custom analysis.

Key CUR insights:

  • Which resources have zero utilization?
  • What percentage of spend is On-Demand vs committed?
  • Where is data transfer cost concentrated?

Strategy 3: Set Up Cost Anomaly Detection

AWS Cost Anomaly Detection uses ML to identify unexpected spend spikes. Configure alerts per service, account, or cost allocation tag. Catches runaway resources before they become $10K problems.

Strategy 4: Per-Account AWS Budgets

Set monthly budgets per account with alerts at 50%, 80%, and 100% thresholds. Optionally trigger automatic actions (stop EC2 instances, apply restrictive SCP) when budgets are exceeded in non-production.


Layer 2: Pricing Models — The Biggest Lever

Strategy 5: Compute Savings Plans

Savings: Up to 72% vs On-Demand.

Compute Savings Plans are the most flexible commitment — they apply automatically to any EC2, Fargate, or Lambda usage regardless of instance family, size, OS, or region.

Approach:

  1. Analyze 30-day baseline in Cost Explorer → Savings Plans recommendations
  2. Commit to covering your steady-state floor (typically 60-70% of average usage)
  3. Let On-Demand cover the peaks above commitment

Rule: Never commit to more than your minimum usage floor. Over-commitment is waste.

Strategy 6: EC2 Reserved Instances (for specific workloads)

RIs give deeper discounts than Savings Plans (up to 75%) but lock you to specific instance family + region. Use for:

  • RDS databases (fixed instance type, always running)
  • ElastiCache clusters
  • OpenSearch domains
  • Redshift clusters

Strategy 7: Spot Instances for Fault-Tolerant Workloads

Savings: Up to 90% vs On-Demand.

Use Spot for:

  • Batch processing, data pipelines, ETL jobs
  • CI/CD build agents
  • Stateless web tier (behind ALB with multiple instance types)
  • EKS/ECS worker nodes (with mixed capacity strategy)
  • SageMaker training jobs

Key: Use Spot Fleet or EC2 Auto Scaling with multiple instance types and AZs to reduce interruption risk.

Strategy 8: Graviton Migration

Savings: 20-40% better price-performance vs x86.

AWS Graviton (ARM-based) instances offer immediate savings with no code changes for most workloads:

  • m7g instead of m7i (general purpose)
  • c7g instead of c7i (compute-optimized)
  • r7g instead of r7i (memory-optimized)

What works out of the box: Java, Python, Node.js, .NET 6+, Go, containers, databases (RDS, ElastiCache, OpenSearch all support Graviton).

Migration path: Start with non-production → validate performance → switch production during next deployment.


Layer 3: Rightsizing — Match Resources to Demand

Strategy 9: EC2 Rightsizing with Compute Optimizer

AWS Compute Optimizer analyzes 14 days of CloudWatch metrics and recommends:

  • Downsizing over-provisioned instances
  • Upsizing under-performing instances
  • Moving to Graviton

Reality check: Most organizations have 30-40% of EC2 instances over-provisioned by at least one size. A m5.xlarge running at 5% CPU should be an m5.large or smaller.

Strategy 10: Auto Scaling Everything

If a workload doesn't run 24/7, it shouldn't pay 24/7:

Service Scaling Approach
EC2 Target tracking on CPU/memory + scheduled scaling
ECS/Fargate Service auto scaling on request count
Lambda Inherently auto-scales (pay per invocation)
RDS Aurora Auto Scaling for read replicas
DynamoDB On-demand mode or auto scaling for provisioned

Strategy 11: Stop/Start Non-Production Resources

Development and staging environments don't need to run nights and weekends. Schedule EC2, RDS, and EKS node groups to stop outside business hours.

Savings: ~65% on dev/staging compute (running 10 hours/day × 5 days vs 24/7).

Tools: AWS Instance Scheduler, EventBridge + Lambda, or Terraform with lifecycle schedules.

Strategy 12: Identify and Terminate Zombie Resources

Common zombies:

  • Unattached EBS volumes (charged even when not attached)
  • Idle Elastic IPs ($3.65/month per unused EIP)
  • Old EBS snapshots beyond retention policy
  • Idle load balancers (no healthy targets)
  • Unused NAT Gateways ($32/month + data processing)
  • Orphaned RDS snapshots

Detection: Trusted Advisor + custom Config rules + Cost Explorer filtering for zero-traffic resources.


Layer 4: Architecture — Design for Cost

Strategy 13: Storage Tiering

S3 storage classes offer massive savings for infrequently accessed data:

Class Use Case Savings vs Standard
S3 Standard Frequently accessed Baseline
S3 Intelligent-Tiering Unknown/changing access patterns Automatic, ~40%
S3 Standard-IA Accessed < 1x/month ~45%
S3 Glacier Instant Retrieval Archives needing millisecond access ~68%
S3 Glacier Flexible Archives (5-12 hour retrieval OK) ~78%
S3 Glacier Deep Archive Compliance archives (12+ hour retrieval) ~95%

Action: Enable S3 Lifecycle rules to automatically transition objects. Use Intelligent-Tiering as default if access patterns are unpredictable.

EBS: Switch gp2 volumes to gp3 (20% cheaper, better baseline performance). Evaluate whether io2 is truly needed or if gp3 with provisioned IOPS suffices.

Strategy 14: Reduce Data Transfer Costs

Data transfer is the hidden AWS cost killer:

Path Cost Mitigation
Cross-region transfer $0.02/GB Keep data and compute in same region
Internet egress $0.09/GB (first 10TB) CloudFront ($0.085/GB, cheaper at scale)
Cross-AZ transfer $0.01/GB each direction Place tightly-coupled services in same AZ
NAT Gateway processing $0.045/GB Use VPC endpoints for AWS services ($0)

Quick wins:

  • VPC endpoints for S3 and DynamoDB (Gateway endpoints are free)
  • Interface endpoints for frequently-called AWS APIs (cheaper than NAT Gateway data processing)
  • CloudFront for static content (cheaper than direct S3 egress)
  • Same-AZ placement for chatty services

Strategy 15: Serverless Where Appropriate

For variable or low-throughput workloads, serverless eliminates idle capacity cost:

Instead of... Use... When...
Always-on EC2 for APIs Lambda + API Gateway < 1M requests/month
EC2 for scheduled jobs Lambda + EventBridge Jobs under 15 min
Self-managed Kafka EventBridge or SQS Event routing without ordering guarantees
EC2 for containers Fargate Variable workloads, no cluster management
RDS for simple key-value DynamoDB On-Demand Unpredictable traffic patterns

Warning: Serverless isn't always cheaper at high scale. Above ~1M invocations/month, compare Lambda cost vs a small EC2 instance.

Strategy 16: Caching to Reduce Downstream Costs

Every cache hit avoids a database query, API call, or compute operation:

  • CloudFront — Cache static and dynamic content at edge (reduces origin compute + data transfer)
  • ElastiCache (Redis/Memcached) — Cache database queries (reduces RDS cost/load)
  • DAX — DynamoDB accelerator (reduces read cost for hot keys)
  • API Gateway caching — Cache API responses (reduces Lambda invocations)

Layer 5: Governance — Sustain Savings

Strategy 17: FinOps Operating Model

Cost optimization isn't a one-time project. Establish:

  • Weekly cost review — 15 minutes, engineering leads review team spend vs budget
  • Monthly optimization sprint — Dedicated time for rightsizing, commitment review, zombie cleanup
  • Quarterly commitment planning — Review Savings Plan/RI coverage and adjust
  • Cost ownership — Teams own their account spend. No central team absorbs everyone's waste.

Strategy 18: Automated Cleanup Policies

Automate what humans forget:

  • Delete EBS snapshots older than retention policy (Lambda + CloudWatch Events)
  • Terminate dev instances running > 12 hours on weekends
  • Remove unattached EBS volumes after 7 days
  • Expire unused Elastic IPs after 48 hours
  • Tag compliance enforcement (auto-tag with "Owner: unknown" → alert → terminate after 7 days)

Strategy 19: Right-size Commitments Quarterly

Savings Plan and RI coverage drifts as workloads change. Review quarterly:

  • Are you under-committed? (too much On-Demand spend)
  • Are you over-committed? (paying for unused commitment)
  • Has instance family usage shifted? (Graviton migration changes commitment needs)

Use Cost Explorer's Savings Plans utilization report to track coverage.

Strategy 20: Implement Showback/Chargeback

Make cost visible to decision-makers:

  • Showback — Show teams their spend (awareness, no billing impact)
  • Chargeback — Charge teams for their consumption (accountability)

Tag-based cost allocation + CUR + Athena dashboards make this possible without third-party tools.


The Quick-Win Priority List

If you can only do 5 things today:

  1. Buy Compute Savings Plans for your usage floor (immediate 30-50% savings on covered compute)
  2. Switch gp2 → gp3 volumes (20% cheaper, zero downtime, no code change)
  3. Enable S3 Lifecycle rules (move old objects to cheaper tiers automatically)
  4. Add VPC endpoints for S3 (eliminates NAT Gateway data processing charges)
  5. Schedule non-prod stop/start (65% savings on dev/staging compute)

These five typically yield 25-35% total savings with minimal effort.


AWS Native Cost Tools Summary

Tool Purpose
Cost Explorer Visual spend analysis, forecasting, and Savings Plan recommendations
Cost and Usage Reports Line-item billing detail for custom analysis
Budgets Set spending limits with alerts and automated actions
Cost Anomaly Detection ML-based detection of unexpected spend spikes
Compute Optimizer Rightsizing recommendations for EC2, EBS, Lambda, ECS
Trusted Advisor Identifies idle resources and optimization opportunities
Savings Plans Flexible commitment discounts for compute
S3 Storage Lens S3-specific cost and usage analytics
VPC IPAM Tracks IP usage (relevant for NAT Gateway optimization)

Summary

AWS cost optimization is a layered discipline:

  1. Visibility first — Tags, CUR, anomaly detection. You can't optimize what you can't see.
  2. Pricing models — Savings Plans and Spot cover 50-70% of compute savings potential.
  3. Rightsizing — Compute Optimizer + Auto Scaling + scheduled scaling for non-prod.
  4. Architecture — Storage tiering, VPC endpoints, caching, serverless for variable workloads.
  5. Governance — FinOps operating model, automated cleanup, quarterly commitment reviews.

The teams that sustain savings long-term treat cost as an engineering metric — reviewed weekly, optimized continuously, and owned by the teams that provision resources.


Alpesh Kumbhare is an AWS Architect at Atos, specializing in AWS infrastructure automation and cloud cost optimization. Connect on LinkedIn.

Top comments (0)