Cloud Cost Optimization on AWS: A Practical Guide to Reducing Your Infrastructure Bill

Introduction

Cloud cost optimization is one of the most critical yet overlooked aspects of cloud architecture. According to Flexera’s 2025 State of the Cloud Report, organizations waste an estimated 28-32% of their cloud spend on average. For a company spending $100,000 per month on AWS, that’s up to $384,000 in annual waste. This tutorial walks through actionable, battle-tested strategies to reduce your AWS bill without sacrificing performance or reliability.

💡 The 30% Rule: Most organizations can save 30% on AWS costs within 90 days using the techniques in this guide — no application rewrites required.

1. Visibility First: Setting Up AWS Cost Explorer

Before optimizing, you need to know where your money is going. AWS Cost Explorer provides granular cost breakdowns by service, region, account, and resource tag.

Enabling Cost Explorer

If you haven’t already enabled Cost Explorer, do so from the AWS Billing Console:

  1. Navigate to AWS Billing → Cost Explorer
  2. Click “Enable Cost Explorer”
  3. Wait 24 hours for data to populate (historical data for the past 12 months will appear)

Creating a Cost Anomaly Detection Alert

# Use AWS CLI to create a cost anomaly monitor
aws ce create-anomaly-monitor \
  --monitor-name "Daily-Spend-Monitor" \
  --monitor-type "CUSTOM" \
  --monitor-specification '{
    "MonitorArn": "",
    "MonitorName": "Daily-Spend-Monitor",
    "MonitorType": "DIMENSIONAL"
  }'

# Create a subscription to get email alerts
aws ce create-anomaly-subscription \
  --subscription-name "Engineering-Alerts" \
  --subscribers '[{"Address": "cloud-team@nova-tech.cloud", "Type": "EMAIL"}]' \
  --monitor-arn-list '["arn:aws:ce:::anomalymonitor/your-monitor-id"]'

Using Cost Categories

Group your costs by team, project, or environment using Cost Categories:

aws ce create-cost-category-definition \
  --name "Environment" \
  --rules '[
    {"Value": "Production", "Rule": {"Tags": {"Key": "Environment", "Values": ["prod", "production"], "MatchOptions": ["EQUALS"]}}},
    {"Value": "Staging", "Rule": {"Tags": {"Key": "Environment", "Values": ["staging", "stage", "test"], "MatchOptions": ["EQUALS"]}}},
    {"Value": "Development", "Rule": {"Tags": {"Key": "Environment", "Values": ["dev", "development"], "MatchOptions": ["EQUALS"]}}}
  ]'

2. Right-Sizing EC2 Instances

Compute is typically the largest line item on any AWS bill. Right-sizing — matching instance types to actual workload requirements — is the fastest path to savings.

Using AWS Compute Optimizer

AWS Compute Optimizer analyzes your instance utilization metrics and makes recommendations:

# Enable Compute Optimizer
aws compute-optimizer update-enrollment-status --status "Active"

# Get recommendations for EC2 instances
aws compute-optimizer get-ec2-instance-recommendations \
  --filters '[{"name": "Finding", "values": ["Overprovisioned", "Underprovisioned"]}]' \
  --max-results 50

Practical Right-Sizing Process

Step Action Expected Savings
1 Identify instances with CPU utilization < 20% over 30 days 40-60% per instance
2 Downgrade to smaller instance family (e.g., t3.large → t3.medium) 50%
3 Switch to Graviton (ARM-based) instances where compatible 20-40%
4 Move burstable workloads to T-series with appropriate credits 30-50%
5 Use Savings Plans for steady-state workloads 50-72%

Automating Right-Sizing with Instance Scheduler

For non-production environments, stop instances during off-hours:

# Tag instances you want to schedule
aws ec2 create-tags \
  --resources i-0abcdef1234567890 \
  --tags Key=Schedule,Value=office-hours

# Deploy AWS Instance Scheduler (CloudFormation template from AWS Solutions)
# This automatically stops/start instances based on a configurable schedule
# Typical savings: 65% for dev/test instances

3. AWS Savings Plans and Reserved Instances

For predictable workloads, committing to a 1-year or 3-year term can slash costs dramatically.

Compute Savings Plans (Recommended)

Compute Savings Plans apply to any EC2 instance, Lambda, or Fargate usage — they’re the most flexible option:

# Purchase a Compute Savings Plan via AWS CLI
aws ce purchase-savings-plan \
  --savings-plan-offering-id "your-offering-id" \
  --commitment "100.00" \
  --savings-plan-payment-option "No Upfront" \
  --savings-plan-type "COMPUTE" \
  --purchase-time "$(date -u +'%Y-%m-%dT%H:%M:%SZ')"

EC2 Instance Savings Plans

If you know your instance family (e.g., m6i), EC2 Instance Savings Plans offer slightly better discounts:

# Calculate potential savings
aws ce get-savings-plans-coverage \
  --time-period Start=2025-01-01,End=2025-12-31 \
  --granularity MONTHLY

Pro Tip: Always start with a 1-year No Upfront commitment to test the waters. After 6 months, assess usage and consider converting to a 3-year Partial Upfront for maximum savings.

4. S3 Storage Cost Optimization

S3 costs can balloon quickly from data storage, request costs, and data transfer. Implement lifecycle policies to automatically move data to cheaper tiers.

Lifecycle Policy Example

# Create a lifecycle policy that transitions objects
# Standard (30 days) → Infrequent Access (90 days) → Glacier (365 days) → Deep Archive (delete after 7 years)

cat > lifecycle.json << 'EOF'
{
  "Rules": [
    {
      "Id": "Auto-Tiering",
      "Status": "Enabled",
      "Filter": {"Prefix": ""},
      "Transitions": [
        {"Days": 30, "StorageClass": "STANDARD_IA"},
        {"Days": 90, "StorageClass": "GLACIER_INSTANT_RETRIEVAL"},
        {"Days": 365, "StorageClass": "DEEP_ARCHIVE"}
      ],
      "Expiration": {
        "Days": 2555
      }
    }
  ]
}
EOF

aws s3api put-bucket-lifecycle-configuration \
  --bucket nova-tech-logs \
  --lifecycle-configuration file://lifecycle.json

Using S3 Intelligent-Tiering

If access patterns are unpredictable, use S3 Intelligent-Tiering which auto-moves data between tiers:

# Enable Intelligent-Tiering on a bucket
aws s3api put-bucket-intelligent-tiering-configuration \
  --bucket nova-tech-assets \
  --id "AutoTierConfig" \
  --intelligent-tiering-configuration '{
    "Id": "AutoTierConfig",
    "Status": "Enabled",
    "Tierings": [
      {"Days": 0, "AccessTier": "ARCHIVE_ACCESS"},
      {"Days": 180, "AccessTier": "DEEP_ARCHIVE_ACCESS"}
    ]
  }'

5. Serverless and Managed Services

Moving from provisioned to serverless architectures eliminates idle capacity costs entirely.

Lambda Cost Optimization

# Review Lambda cost by function
aws lambda list-functions --query 'Functions[*].[FunctionName,MemorySize]' --output table

# Increase memory to improve execution time (Lambda pricing includes compute time)
# A function with 1024MB running for 200ms costs the same as 512MB running for 400ms
# But higher memory = faster execution = potentially lower total cost

# Provisioned Concurrency vs On-Demand
# Use Provisioned Concurrency only for latency-sensitive functions
# For batch/async workloads, stick with on-demand

RDS to Aurora Serverless

For databases with variable load, Aurora Serverless v2 auto-scales and can reduce costs by 60%+:

# Create an Aurora Serverless v2 cluster
aws rds create-db-cluster \
  --db-cluster-identifier nova-serverless-db \
  --engine aurora-postgresql \
  --engine-version 15.4 \
  --serverless-v2-scaling-configuration MinCapacity=0.5,MaxCapacity=8 \
  --database-name novaapp

# Compare costs: a small RDS db.t3.medium runs ~$50/month 24/7
# Aurora Serverless with 0.5-2 ACU runs ~$15-40/month for development workloads

6. Data Transfer Cost Reduction

Data transfer (egress) is often a hidden cost. AWS charges $0.09/GB for internet egress for the first 10TB.

Strategies to Reduce Data Transfer

  • Use CloudFront as a CDN: CloudFront egress is $0.085/GB, and free to AWS origins — plus data transfer from origin to edge is free
  • Use VPC Endpoints: Connect to S3 and DynamoDB privately without NAT Gateway ($32+/month) or transit costs
  • Multi-AZ vs Multi-Region: AZ-to-AZ transfer is $0.01/GB each way; Region-to-Region is $0.02/GB. Design for data locality
  • Compress data: Enable gzip/brotli compression for all HTTP responses
# Set up a VPC Gateway Endpoint for S3 (free, no hourly charge)
aws ec2 create-vpc-endpoint \
  --vpc-id vpc-0abc1234567890def \
  --service-name com.amazonaws.us-east-1.s3 \
  --route-table-ids rtb-0abc1234567890def \
  --vpc-endpoint-type Gateway

7. AWS Budgets and Cost Alarms

Prevent bill shock by setting up proactive alerts:

# Create a budget that alerts at 80% and 100% of $5,000 monthly
cat > budget.json << 'EOF'
{
  "BudgetName": "Monthly-Cloud-Budget",
  "BudgetLimit": {"Amount": "5000", "Unit": "USD"},
  "CostFilters": {},
  "CostTypes": {
    "IncludeTax": false,
    "IncludeSubscription": true,
    "UseBlended": false,
    "IncludeRefund": false,
    "IncludeCredit": false,
    "IncludeUpfront": true,
    "IncludeRecurring": true,
    "IncludeOtherSubscription": true,
    "IncludeSupport": true,
    "IncludeDiscount": true,
    "UseAmortized": true
  },
  "TimeUnit": "MONTHLY",
  "BudgetType": "COST",
  "BudgetLimit": {"Amount": "5000", "Unit": "USD"}
}
EOF

aws budgets create-budget \
  --account-id $(aws sts get-caller-identity --query Account --output text) \
  --budget file://budget.json \
  --notifications-with-subscribers '[
    {
      "Notification": {"NotificationType": "ACTUAL", "ComparisonOperator": "GREATER_THAN", "Threshold": 80, "ThresholdType": "PERCENTAGE"},
      "Subscribers": [{"SubscriptionType": "EMAIL", "Address": "cloud-team@nova-tech.cloud"}]
    },
    {
      "Notification": {"NotificationType": "ACTUAL", "ComparisonOperator": "GREATER_THAN", "Threshold": 100, "ThresholdType": "PERCENTAGE"},
      "Subscribers": [{"SubscriptionType": "EMAIL", "Address": "cloud-team@nova-tech.cloud"}]
    }
  ]'

8. Tagging Strategy for Cost Allocation

Without proper tagging, you can't attribute costs to teams, projects, or environments. A consistent tagging strategy is the foundation of cost accountability.

Mandatory Tag Schema

Tag Key Example Values Purpose
Environment production, staging, development, testing Identify non-prod resources for scheduling
Team platform, backend, data, ml Charge-back to departments
Project nova-core, customer-portal, analytics-v2 Track project-specific costs
CostCenter CC-1234, CC-5678 Accounting/cost allocation
AutoOffHours true, false Flag resources safe to stop at night

Enforce Tags with Service Control Policies

# SCP to require tags on resource creation (organizations only)
{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Sid": "RequireTags",
      "Effect": "Deny",
      "Action": [
        "ec2:RunInstances",
        "rds:CreateDBInstance",
        "lambda:CreateFunction"
      ],
      "Resource": "*",
      "Condition": {
        "Null": {
          "aws:RequestTag/Environment": "true",
          "aws:RequestTag/Team": "true",
          "aws:RequestTag/CostCenter": "true"
        }
      }
    }
  ]
}

9. Putting It All Together: A Cost Optimization Checklist

Here's a phased approach to implement everything we've covered:

Phase 1: Visibility (Week 1)

  • Enable Cost Explorer and Cost Anomaly Detection
  • Set up AWS Budgets with 80%/100% alerts
  • Tag all existing resources with the mandatory schema
  • Review AWS Trusted Advisor cost recommendations

Phase 2: Quick Wins (Week 2-3)

  • Run Compute Optimizer and downsize overprovisioned instances
  • Implement S3 lifecycle policies on all buckets
  • Purchase 1-year Compute Savings Plans for steady-state workloads
  • Delete unattached EBS volumes and old snapshots
  • Remove idle load balancers and unused Elastic IPs

Phase 3: Architecture Optimization (Week 4-8)

  • Migrate suitable workloads to Graviton instances
  • Implement Instance Scheduler for non-production environments
  • Evaluate RDS → Aurora Serverless for variable-load databases
  • Set up VPC endpoints to reduce NAT Gateway costs
  • Implement CloudFront for data transfer reduction

Phase 4: Continuous Optimization (Ongoing)

  • Review Compute Optimizer recommendations monthly
  • Track cost per team/department with Cost Categories
  • Conduct quarterly right-sizing reviews
  • Renegotiate Savings Plans or Reserved Instances before expiry

Conclusion

Cloud cost optimization is not a one-time project — it's an ongoing practice. By implementing the strategies outlined in this guide, organizations consistently achieve 25-40% reductions in AWS spending within the first quarter. Start with visibility and quick wins, then layer in architectural changes as your team builds momentum.

The key takeaways are straightforward: right-size your compute, use lifecycle policies on S3, commit to Savings Plans for predictable workloads, tag everything, and monitor relentlessly.

Next Steps: Nova Tech Cloud offers cloud architecture consulting to help optimize your AWS environment. Contact our team to schedule a cost optimization audit. We'll analyze your current spend and deliver a prioritized action plan with projected savings.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top