DEV Community

Ace7-coder
Ace7-coder

Posted on Edited on

AWS FinOps Field Notes: Cutting EBS Storage Costs 20% with gp2-to-gp3 Audits in Python

While auditing cloud infrastructure costs this week, recurring configuration gaps continue to quietly inflate monthly bills.

Field Insight: The Hidden Cost Trap

gp2 costs $0.10/GB-month versus gp3 at $0.08/GB-month—an exact 20% reduction on provisioned storage—and gp3 includes 3,000 baseline IOPS and 125 MB/s throughput free, eliminating gp2's 3 IOPS/GB burst-bucket penalty. A 40 TB EBS fleet on gp2 costs $4,000/month ($48,000/year); moving to gp3 drops it to $3,200/month ($38,400/year), saving $9,600/year with zero downtime using the AWS Elastic Volumes API.

Automated Detection: Auditing Legacy gp2 Volumes with Boto3

import boto3

def audit_gp2_volumes(region='us-east-1'):
    ec2 = boto3.client('ec2', region_name=region)
    volumes = ec2.describe_volumes(
        Filters=[{'Name': 'volume-type', 'Values': ['gp2']}]
    ).get('Volumes', [])

    total_gb = sum(vol['Size'] for vol in volumes)
    monthly_savings = total_gb * 0.02  # $0.10/GB (gp2) -> $0.08/GB (gp3)
    print(f"[{region}] Found {len(volumes)} gp2 volume(s) ({total_gb} GiB) | Est. gp3 savings: ${monthly_savings:.2f}/mo")
    for vol in volumes:
        print(f" - {vol['VolumeId']} | {vol['Size']} GiB | State: {vol['State']}")
    return volumes

if __name__ == '__main__':
    audit_gp2_volumes()
Enter fullscreen mode Exit fullscreen mode

Running ad-hoc scripts in a single account or region does not scale across enterprise AWS Organizations. Sustained cloud cost governance requires automated anomaly detection, cross-account STS role assumption, and scheduled auditing.

  • 📦 Download Free Single-Account Core: Free Lite Package | GitHub
  • 💼 Managing Multiple Accounts or Client Infrastructure?
    • Practitioner License ($99): Single-account CLI scanner, compliance exports, and dynamic bash remediation.
    • Consultancy & Agency Pack ($499): Automated multi-account STS role assumption, CloudFormation StackSets, and branded executive PDF showback reports.

👉 Get the AWS Cloud Cost Auditor on Gumroad

Top comments (0)