{"id":13821237,"url":"https://github.com/katapultcloud/check_unattached_ebs_volumes","last_synced_at":"2026-04-04T16:19:03.848Z","repository":{"id":37819077,"uuid":"141811001","full_name":"katapultcloud/check_unattached_ebs_volumes","owner":"katapultcloud","description":"The script loops through all AWS regions where EC2 service is available, checks for unattached EBS volumes and calculates the price for them.","archived":false,"fork":false,"pushed_at":"2022-06-22T14:54:16.000Z","size":21,"stargazers_count":15,"open_issues_count":0,"forks_count":12,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-11-19T21:35:59.607Z","etag":null,"topics":["aws","cost-control","cost-estimation","ebs","pricing","unused-resources"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/katapultcloud.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-07-21T12:39:09.000Z","updated_at":"2023-01-10T18:36:36.000Z","dependencies_parsed_at":"2022-08-19T05:50:19.240Z","dependency_job_id":null,"html_url":"https://github.com/katapultcloud/check_unattached_ebs_volumes","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/katapultcloud%2Fcheck_unattached_ebs_volumes","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/katapultcloud%2Fcheck_unattached_ebs_volumes/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/katapultcloud%2Fcheck_unattached_ebs_volumes/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/katapultcloud%2Fcheck_unattached_ebs_volumes/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/katapultcloud","download_url":"https://codeload.github.com/katapultcloud/check_unattached_ebs_volumes/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254530639,"owners_count":22086651,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aws","cost-control","cost-estimation","ebs","pricing","unused-resources"],"created_at":"2024-08-04T08:01:18.423Z","updated_at":"2026-04-04T16:19:03.824Z","avatar_url":"https://github.com/katapultcloud.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"# check_unattached_ebs_volumes\nThis script provides a pricing and capacity summary of unattached EBS volumes in all regions where EC2 service is available.\n\n## How it works\nThe script fetches all regions with EC2 service enabled, then loops through all of them and fetches all unattached EBS volumes adds them into categories based on EBS type. Then the script fetches current EBS prices from AWS Pricing API for specified region and calculates EBS monthly expenditures for unattached EBS volumes per type. \n\n## Requirements\n* boto3\n* os\n* argparse\n* json\n\n## Options\nThis is the help output from the script. \n```\n$ ./check_unattached_ebs_volumes.py --help\nusage: check_unattached_ebs_volumes.py [-h] [-p PROFILE] [-i AWS_ID]\n                                       [-k AWS_SECRET_KEY] [-e] [-v] [-j]\n\nDetermine unused EC2 resources\n\noptional arguments:\n  -h, --help            show this help message and exit\n  -p PROFILE, --profile PROFILE\n                        aws profile to use, \"default\" profile is used if not\n                        specified\n  -i AWS_ID, --aws-id AWS_ID\n                        aws access key id to use\n  -k AWS_SECRET_KEY, --aws-secret-key AWS_SECRET_KEY\n                        aws secret access key to use\n  -e, --env             enable authentication using AWS_ACCESS_KEY_ID and\n                        AWS_SECRET_ACCESS_KEY environmental vars\n  -v, --verbose         display verbose output including pricing for each\n                        storage type\n  -j, --json            display json output including pricing for each storage\n                        type\n```\n\n### Authentication\nThe script is able to utilise multiple authentication methods, first using profiles from `~/.aws/credentials` (preffered) and second using direct credentials as arguments to the script (not preffered). Third method is using environmental variables `AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY` (not preffered).\n\n## Examples\n\nUsing the script in non-verbose mode with `default` profile.\n```\n$ ./check_unattached_ebs_volumes.py\n\nEU (Ireland)\nvol-02d1ed6d9f4a37cf3\n\nAsia Pacific (Seoul)\nvol-02f4546ce9c041e02\nvol-0a26780232630b716\n\nCanada (Central)\nvol-04c69735fab373103\n\nTotal Price\n-------------\n$12.328\n\n```\n\nUsing the script in json mode with different AWS profile. JSON output is parsed with `jq` for show.\n```\n$ ./check_unattached_ebs_volumes.py --profile ebs_user --json | jq .\n{\n  \"regional_data\": {\n    \"eu-west-1\": {\n      \"friendly_name\": \"EU (Ireland)\",\n      \"price_per_gb\": {\n        \"standard\": 0.055,\n        \"gp2\": 0.11,\n        \"io1\": 0.138,\n        \"st1\": 0.05,\n        \"sc1\": 0.028\n      },\n      \"price_per_ebs\": {\n        \"standard\": 0,\n        \"gp2\": 11,\n        \"io1\": 0,\n        \"st1\": 0,\n        \"sc1\": 0\n      },\n      \"size_per_ebs\": {\n        \"gp2\": 100,\n        \"standard\": 0,\n        \"sc1\": 0,\n        \"io1\": 0,\n        \"st1\": 0\n      },\n      \"total_price\": 11,\n      \"unused_volumes\": [\n        \"vol-02d1ed6d9f4a37cf3\"\n      ]\n    },\n    \"ap-northeast-2\": {\n      \"friendly_name\": \"Asia Pacific (Seoul)\",\n      \"price_per_gb\": {\n        \"standard\": 0.08,\n        \"gp2\": 0.114,\n        \"io1\": 0.1278,\n        \"st1\": 0.051,\n        \"sc1\": 0.029\n      },\n      \"price_per_ebs\": {\n        \"standard\": 0,\n        \"gp2\": 0.228,\n        \"io1\": 0,\n        \"st1\": 0,\n        \"sc1\": 0\n      },\n      \"size_per_ebs\": {\n        \"gp2\": 2,\n        \"standard\": 0,\n        \"sc1\": 0,\n        \"io1\": 0,\n        \"st1\": 0\n      },\n      \"total_price\": 0.228,\n      \"unused_volumes\": [\n        \"vol-02f4546ce9c041e02\",\n        \"vol-0a26780232630b716\"\n      ]\n    },\n    \"ca-central-1\": {\n      \"friendly_name\": \"Canada (Central)\",\n      \"price_per_gb\": {\n        \"standard\": 0.055,\n        \"gp2\": 0.11,\n        \"io1\": 0.138,\n        \"st1\": 0.05,\n        \"sc1\": 0.028\n      },\n      \"price_per_ebs\": {\n        \"standard\": 0,\n        \"gp2\": 1.1,\n        \"io1\": 0,\n        \"st1\": 0,\n        \"sc1\": 0\n      },\n      \"size_per_ebs\": {\n        \"gp2\": 10,\n        \"standard\": 0,\n        \"sc1\": 0,\n        \"io1\": 0,\n        \"st1\": 0\n      },\n      \"total_price\": 1.1,\n      \"unused_volumes\": [\n        \"vol-04c69735fab373103\"\n      ]\n    }\n  },\n  \"total_price\": 12.328\n}\n```\n\nUsing the script in verbose mode with different AWS profile.\n```\n$ ./check_unattached_ebs_volumes.py --profile ebs_user --verbose\n\nchecking: Asia Pacific (Mumbai)\nno unused volumes found...\n\nchecking: EU (Paris)\nno unused volumes found...\n\nchecking: EU (London)\nno unused volumes found...\n\nchecking: EU (Ireland)\nfound unused volumes!\nvol-02d1ed6d9f4a37cf3\ntotal price: $11.0\n\nchecking: Asia Pacific (Seoul)\nfound unused volumes!\nvol-02f4546ce9c041e02\nvol-0a26780232630b716\ntotal price: $0.228\n\nchecking: Asia Pacific (Tokyo)\nno unused volumes found...\n\nchecking: South America (Sao Paulo)\nno unused volumes found...\n\nchecking: Canada (Central)\nfound unused volumes!\nvol-04c69735fab373103\ntotal price: $1.1\n\nchecking: Asia Pacific (Singapore)\nno unused volumes found...\n\nchecking: Asia Pacific (Sydney)\nno unused volumes found...\n\nchecking: EU (Frankfurt)\nno unused volumes found...\n\nchecking: US East (N. Virginia)\nno unused volumes found...\n\nchecking: US East (Ohio)\nno unused volumes found...\n\nchecking: US West (N. California)\nno unused volumes found...\n\nchecking: US West (Oregon)\nno unused volumes found...\n\nTotal Price\n-------------\n$12.328\n```\n\nExample when no unattached EBS volumes are found:\n```\n$ ./check_unattached_ebs_volumes.py\nno unused EBS volumes found\n```\n\nExample when no unattached EBS volumes are found in JSON output:\n```\n$ ./check_unattached_ebs_volumes.py --json | jq .\n{}\n```\n\n## Recommendations\nUtilize profile or access keys with minimal privileges to AWS resources. Following priviliges are required to make this work.\n```\n{\n    \"Version\": \"2012-10-17\",\n    \"Statement\": [\n        {\n            \"Effect\": \"Allow\",\n            \"Action\": [\n                \"ec2:DescribeVolumes\",\n                \"ec2:DescribeRegions\",\n                \"pricing:GetProducts\"\n            ],\n            \"Resource\": \"*\"\n        }\n    ]\n}\n```\n\n## Licence\nGPL-v3\n\n## Author Information\nStefan Roman (stefan.roman@katapult.cloud)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkatapultcloud%2Fcheck_unattached_ebs_volumes","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkatapultcloud%2Fcheck_unattached_ebs_volumes","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkatapultcloud%2Fcheck_unattached_ebs_volumes/lists"}