DEV Community

Ace7-coder
Ace7-coder

Posted on

AWS FinOps Field Notes: Automating Orphaned EBS & Infrastructure Cleanup

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

Field Insight: The Hidden Cost Trap

Unattached Elastic IPs bill $0.005/hour per IPv4 address in every region, $3.65/month ($43.80/year) per idle IP for zero bytes routed. An environment with 40 forgotten dev and staging Elastic IPs leaks $146/month ($1,752/year).

Automated Detection: Auditing Detached EBS Volumes with Boto3

import boto3

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

    print(f"[{region}] Found {len(volumes)} unattached volume(s):")
    for vol in volumes:
        print(f" - {vol['VolumeId']} | {vol['Size']} GiB ({vol['VolumeType']})")
    return volumes

if __name__ == '__main__':
    audit_unattached_ebs()

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)