
How to audit your AWS account for waste in 5 minutes using Python
Most AWS accounts have hundreds of dollars in monthly waste hiding in plain sight. The problem isn't that it's hard to find — it's that nobody automates the looking. Here's a 5-minute audit you can run right now. What You'll Need Python 3.x boto3 installed ( pip install boto3 ) Read-only AWS credentials Step 1: Create Read-Only IAM User Create a user with this policy: { "Version" : "2012-10-17" , "Statement" : [ { "Effect" : "Allow" , "Action" : [ "ec2:DescribeInstances" , "ec2:DescribeVolumes" , "ec2:DescribeAddresses" , "ec2:DescribeSnapshots" , "cloudwatch:GetMetricStatistics" , "sts:GetCallerIdentity" ], "Resource" : "*" } ] } Step 2: Find Unattached EBS Volumes These are the silent killers. Volumes that exist but aren't attached to anything — charging you every month. import boto3 def find_unattached_ebs ( region = ' us-east-1 ' ): ec2 = boto3 . client ( ' ec2 ' , region_name = region ) volumes = ec2 . describe_volumes ( Filters = [{ ' Name ' : ' status ' , ' Values ' : [ ' availa
Continue reading on Dev.to DevOps
Opens in a new tab


