DEV Community

Ace7-coder
Ace7-coder

Posted on

AWS FinOps Field Notes: Finding Unattached Elastic IPs and the Public IPv4 Surcharge

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

Field Insight: The Hidden Cost Trap

Orphaned EBS volumes (DescribeVolumes State=available), unattached Elastic IPs (InstanceId null), oversized EKS node pools (DesiredSize vs ActualSize), and Dev/QA EC2 left running outside business hours. Scheduled auto-parking of Dev/QA instances claims a 35% average cost drop with zero downtime for automated tests.

Automated Detection: Auditing Unattached Elastic IPs with Boto3

import boto3

def audit_unattached_eips(region='us-east-1'):
    ec2 = boto3.client('ec2', region_name=region)
    addresses = ec2.describe_addresses().get('Addresses', [])
    unattached = [
        addr['AllocationId']
        for addr in addresses
        if 'AssociationId' not in addr and 'InstanceId' not in addr
    ]
    print(f"[{region}] Unattached Elastic IPs: {len(unattached)} "
          f"(${len(unattached) * 3.65:.2f}/mo at $0.005/hr per IP)")
    for allocation_id in unattached:
        print(f" - {allocation_id}")
    return unattached

if __name__ == '__main__':
    audit_unattached_eips()
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.

  • 📦 Install Free Single-Account CLI: pip install aws-finops-auditor (PyPI | 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)