I want to list all volumes attached to my EC2 instance.
I can list volumes with my code:
conn = EC2Connection()
attribute = get_instance_metadata()
region=attribute['local-hostname'].split('.')[1]
inst_id = attribute['instance-id']
aws = boto.ec2.connect_to_region(region)
volume=attribute['local-hostname']
volumes = str(aws.get_all_volumes(filters={'attachment.instance-id': inst_id}))
But this results in:
[vol-35b0b5fa, Volume:vol-6cbbbea3]
I need something like:
vol-35b0b5fa
vol-6cbbbea3
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…