Created
February 22, 2014 20:42
-
-
Save tsabat/9162127 to your computer and use it in GitHub Desktop.
delete unused ebs volumes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! env python | |
from boto import ec2 | |
conn = ec2.connect_to_region('us-west-2') | |
vols = conn.get_all_volumes(filters={'status': 'available'}) | |
for vol in vols: | |
print 'checking vol:', vol.id, 'status:', vol.status, 'attachment_id:', vol.attach_data.status | |
conn.delete_volume(vol.id) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Can you please help me, what is attachment_id ? and i want to delete both volume and its snapshots do i need to delete snapshots separately or it will get delete if volume is deleting