DEV Community

Ace7-coder
Ace7-coder

Posted on Edited on

AWS FinOps Field Notes (2026-10-31): Automating Orphaned EBS & EC2 Cleanup

While reviewing real-world cloud cost audits this week, the same infrastructure leak kept surfacing across multiple engineering teams: unattached EBS volumes and idle resources quietly inflating the monthly bill.

Where the Waste Hides

  • The Silent Accumulation: As Tim O'Brien recently highlighted, fifty abandoned 100 GB unattached EBS volumes cost roughly $500/month ($6,000/year). Clearing out forgotten storage isn't just a one-off cleanup—it requires continuous ownership tracking because unattached volumes persist indefinitely unless removed.
  • Orphaned Post-Termination Storage: Aman Maheshwari pointed out that in environments running hundreds of EC2 instances, attached EBS volumes often survive instance termination (if DeleteOnTermination was unset) and continue billing unnoticed.
  • The Extended Support Trap: Antonio Augusto Maguelniski shared a case where a client's AWS bill doubled without any new deployments—their RDS costs surged from $30 to $330/month simply because two PostgreSQL 12 instances slipped out of standard support into AWS Extended Support.

Auditing Unattached Volumes with Python & Boto3

Instead of manually clicking through region tabs in the AWS Console, you can query for detached volumes in available state across your infrastructure with a simple Boto3 inspection script:

import boto3

def audit_unattached_ebs(region='us-east-1'):
    ec2 = boto3.client('ec2', region_name=region)

    # Query volumes that are not attached to any running instance
    response = ec2.describe_volumes(
        Filters=[{'Name': 'status', 'Values': ['available']}]
    )

    orphaned_volumes = response.get('Volumes', [])
    print(f"[{region}] Found {len(orphaned_volumes)} unattached EBS volume(s):")

    total_wasted_gb = 0
    for vol in orphaned_volumes:
        vol_id = vol['VolumeId']
        size = vol['Size']
        vol_type = vol['VolumeType']
        total_wasted_gb += size
        print(f" - {vol_id} | {size} GiB ({vol_type}) | Created: {vol['CreateTime'].strftime('%Y-%m-%d')}")

    print(f"Total unattached storage: {total_wasted_gb} GiB")

if __name__ == '__main__':
    audit_unattached_ebs('us-east-1')
Enter fullscreen mode Exit fullscreen mode

Continuous FinOps Automation
Manually deleting disks risks wiping data that still needs an owner review, while leaving them alone guarantees continuous waste. Automated governance requires regular multi-account audits and programmatic reporting before executing snapshots or deletions.

Top comments (0)