Created
March 3, 2017 18:33
-
-
Save chemar/8343f822eba39286b6d42ed3ad436848 to your computer and use it in GitHub Desktop.
AWS EC2 list volumes and attributes using boto3
This file contains hidden or 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
import boto3 | |
ec2 = boto3.resource('ec2') | |
volume_iterator = ec2.volumes.all() | |
for v in volume_iterator: | |
for a in v.attachments: | |
print "{0} {1} {2}".format(v.id, v.state, a['InstanceId']) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment