Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
delete unused ebs volumes
#! 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:',, 'status:', vol.status, 'attachment_id:', vol.attach_data.status

This comment has been minimized.

Copy link

@anjneeksharma anjneeksharma commented Oct 15, 2019

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment