Skip to content

AWS Cost Optimization — Reduce Your Cloud Bill Guide

DodaTech Updated 2026-06-21 6 min read

In this tutorial, you'll learn about AWS Cost Optimization. We cover key concepts, practical examples, and best practices to help you understand and apply this topic effectively.

AWS cost optimization reduces your AWS bill by right-sizing compute, choosing the right pricing model, tiering storage, minimizing data transfer, and enforcing governance through tagging and budgets — without sacrificing performance.

What You'll Learn

By the end of this guide, you'll be able to use AWS Cost Explorer, implement right-sizing with Compute Optimizer, choose between Savings Plans and Reserved Instances, tier S3 storage with lifecycle policies, reduce data transfer costs, and set up budgets and alerts.

Why It Matters

AWS costs grow exponentially as teams provision resources "just in case." The average AWS account wastes 30-45% of spend on over-provisioned instances, orphaned volumes, and unnecessary data transfer. A $50k monthly bill can drop to $30k with structured optimization. DodaTech reduced Durga Antivirus Pro's update infrastructure costs by 40% using Compute Optimizer.

Real-World Use

Netflix saves hundreds of millions annually by right-sizing EC2 fleets and using Spot instances. Airbnb uses tagging to allocate costs across 200+ engineering teams. Intuit reduced AWS spend by 35% through Reserved Instances and storage tiering.

flowchart LR
    A[Cost Explorer] --> B[Rightsizing]
    B --> C[Savings Plans]
    B --> D[Spot Instances]
    A --> E[Storage Tiering]
    A --> F[Tagging & Budgets]
    C --> G[30-60% Savings]
    style G fill:#f59e0b,color:#fff
â„šī¸ Info

Prerequisites: AWS account access, familiarity with EC2 and S3. Understanding of Cloud Computing fundamentals helps.

1. Cost Visibility with Cost Explorer

AWS Cost Explorer visualizes spend, forecasts future costs, and identifies top cost drivers.

aws ce get-cost-and-usage \
  --time-period Start=2026-05-01,End=2026-06-01 \
  --granularity MONTHLY \
  --metrics BlendedCost UnblendedCost \
  --group-by Type=DIMENSION,Key=SERVICE

Expected output:

Results by service:
  Amazon EC2: $18,230
  Amazon S3:  $4,120
  AWS Lambda: $890
  RDS:        $3,450
  Data Transfer: $2,100

2. Right-Sizing EC2 and RDS

The #1 waste driver is over-provisioned compute. Use AWS Compute Optimizer to get recommendations:

aws compute-optimizer get-ec2-instance-recommendations --region us-east-1

Check RDS utilization:

aws cloudwatch get-metric-statistics \
  --namespace AWS/RDS \
  --metric-name CPUUtilization \
  --dimensions Name=DBInstanceIdentifier,Value=prod-db-01 \
  --start-time 2026-05-01T00:00:00Z \
  --end-time 2026-06-01T00:00:00Z \
  --period 3600 \
  --statistics Average

Rule of thumb: If CPU stays below 20% and memory below 30% for 14 days, downsize one tier. An r5.2xlarge (8 vCPU, 64 GB) running at 12% CPU becomes r5.xlarge — saving ~$252/month.

3. Savings Plans vs Reserved Instances

Model Discount Flexibility
Compute Savings Plan 30-66% Instance family, region, OS, tenancy
EC2 Instance Savings Plan 30-72% Instance family within region
Standard RI 30-60% Specific instance type in AZ
Convertible RI 20-50% Change instance family/region
aws savingsplans create-savings-plan \
  --savings-plan-offering-id offering-123456 \
  --commitment 100.00 \
  --term 1year \
  --payment-option PartialUpfront

Buying recommendation: Start with Compute Savings Plans for maximum flexibility. Reserve steady-state baseline at 60-70% of forecasted spend; run spikes on On-Demand or Spot.

4. S3 Storage Tiers

S3 storage ranges from $0.023/GB (Standard) to $0.00099/GB (Deep Archive). Use lifecycle policies to tier automatically:

aws s3api put-bucket-lifecycle-configuration \
  --bucket dodatech-logs \
  --lifecycle-configuration '{
    "Rules": [{
      "Id": "log-lifecycle",
      "Status": "Enabled",
      "Filter": {"Prefix": "access-logs/"},
      "Transitions": [
        {"Days": 30, "StorageClass": "STANDARD_IA"},
        {"Days": 90, "StorageClass": "GLACIER_INSTANT_RETRIEVAL"},
        {"Days": 365, "StorageClass": "DEEP_ARCHIVE"}
      ],
      "Expiration": {"Days": 730}
    }]
  }'

Without tiering: 10TB Standard = $230/month. With lifecycle: $48/month — 79% savings.

5. Data Transfer Costs

Data transfer is the most overlooked cost driver. Egress costs $0.09/GB, cross-region $0.02/GB, cross-AZ $0.01/GB.

# data_transfer_audit.py
services = {
    "NAT Gateway":   {"hr_rate": 0.045, "gb_rate": 0.045, "hours": 730, "gb": 5000},
    "Cross-AZ":      {"hr_rate": 0,     "gb_rate": 0.01,  "hours": 0,   "gb": 30000},
    "Internet egress": {"hr_rate": 0,   "gb_rate": 0.09,  "hours": 0,   "gb": 2000},
    "CloudFront":    {"hr_rate": 0,     "gb_rate": 0.085, "hours": 0,   "gb": 2000},
}
total = sum(s["hr_rate"] * s["hours"] + s["gb_rate"] * s["gb"] for s in services.values())
for name, s in services.items():
    cost = s["hr_rate"] * s["hours"] + s["gb_rate"] * s["gb"]
    print(f"{name:<20} ${cost:>8.2f}/mo")
print(f"{'TOTAL':<20} ${total:>8.2f}/mo")

Expected output:

NAT Gateway          $257.85/mo
Cross-AZ             $300.00/mo
Internet egress      $180.00/mo
CloudFront            $85.00/mo
TOTAL                $822.85/mo

6. Tagging and Budgets

Enforce a mandatory tag set with AWS Config and set budget alerts:

aws configservice put-config-rule \
  --config-rule '{
    "ConfigRuleName": "required-tags",
    "Source": {"Owner": "AWS", "SourceIdentifier": "REQUIRED_TAGS"},
    "InputParameters": "{\"tag1Key\":\"Environment\",\"tag1Value\":\"prod,staging,dev\"}"
  }'

Standard tag taxonomy: Environment, Project, Team, CostCenter, Owner.

aws budgets create-budget \
  --account-id 123456789012 \
  --budget '{"BudgetName":"monthly-compute","BudgetLimit":{"Amount":15000,"Unit":"USD"},"TimeUnit":"MONTHLY","BudgetType":"COST"}' \
  --notifications-with-subscribers '[
    {"Notification":{"NotificationType":"ACTUAL","ComparisonOperator":"GREATER_THAN","Threshold":80,"ThresholdType":"PERCENTAGE"},
     "Subscribers":[{"SubscriptionType":"EMAIL","Address":"finops"@example".com"}]}
  ]'

Common Mistakes

1. No Budget Alerts

A single misconfigured resource can run $100k overnight. Set alerts at 50/80/90/100% of every budget.

2. Right-Sizing Only Once

Workloads change. Review Compute Optimizer recommendations monthly and rightsize continuously.

3. Orphaned EBS Volumes

Deleting an EC2 instance does not delete attached EBS volumes. Use aws ec2 describe-volumes --filters "Name=status,Values=available" to find and clean them.

4. Ignoring Data Transfer Costs

Cross-region traffic, NAT Gateway, and egress are expensive. Design workloads to minimize inter-region data movement.

5. Skipping Storage Tiering

Keeping all data in S3 Standard is 20x more expensive than transitioning cold data to Glacier or Deep Archive.

Practice Questions

1. What is the difference between a Compute Savings Plan and an EC2 Instance Savings Plan? Compute Savings Plan applies to any EC2, Lambda, and Fargate across regions. EC2 Instance Savings Plan applies to a specific instance family within a region but offers higher discounts.

2. How do you detect orphaned EBS volumes? aws ec2 describe-volumes --filters "Name=status,Values=available" lists unattached volumes. Automate deletion with a Lambda function.

3. What is the most effective single action to reduce AWS costs? Enable AWS Compute Optimizer and implement its rightsizing recommendations. This alone typically saves 20-35% of compute spend.

4. Challenge: Audit a $75k/month AWS account: pull Cost Explorer data for the last 3 months, identify the top 3 services by spend, run Compute Optimizer, create lifecycle policies for all buckets, implement required tagging, and set up budget alerts.

Mini Project: Cost Anomaly Detector

class CostAnomalyDetector:
    def __init__(self, threshold_pct=20):
        self.threshold = threshold_pct
        self.history = []

    def record_daily_cost(self, service, cost):
        self.history.append({"service": service, "cost": cost, "day": len(self.history) + 1})

    def check_anomalies(self):
        from collections import defaultdict
        by_service = defaultdict(list)
        for h in self.history:
            by_service[h["service"]].append(h["cost"])
        for service, costs in by_service.items():
            if len(costs) >= 3:
                avg = sum(costs[:-1]) / (len(costs) - 1)
                latest = costs[-1]
                change = ((latest - avg) / avg) * 100
                if abs(change) > self.threshold:
                    print(f"ANOMALY: {service} cost changed by {change:.1f}% (${avg:.0f} → ${latest:.0f})")

detector = CostAnomalyDetector()
for day in range(1, 8):
    detector.record_daily_cost("EC2", 500 + (50 if day > 5 else 0))
for day in range(1, 8):
    detector.record_daily_cost("S3", 100)
detector.check_anomalies()

FAQ

What is the average savings from AWS cost optimization?

Most organizations save 30-45% in the first year through rightsizing, pricing model optimization, and storage tiering.

Are Savings Plans better than Reserved Instances?

For most workloads, yes. Compute Savings Plans offer more flexibility with similar discounts. RIs are better for specific instance families with steady-state predictable usage.

What is the biggest hidden cost in AWS?

Data transfer. Egress charges and NAT Gateway costs are frequently overlooked during architecture design. Cross-AZ and cross-region traffic add up quickly.

Cloud Cost Tools
Azure Cost Guide
Spot Instances Guide

What's Next

You now understand AWS cost optimization! Next, learn about Azure Cost optimization, then explore Multi-Cloud Cost optimization for managing costs across multiple providers.

  • Practice daily — Review your AWS Cost Explorer dashboard
  • Build a project — Automate orphaned EBS volume cleanup with Lambda
  • Explore related topics — Check out reserved instances deep dive

Built by the developers of Doda Browser, DodaZIP, and Durga Antivirus Pro.

Built by the developers of DodaTech

Doda Browser, DodaZIP & Durga Antivirus Pro