我想列出附加到ec2的所有卷.
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}))
Run Code Online (Sandbox Code Playgroud)
使用我的代码我可以列出音量但结果是这样的:
[vol-35b0b5fa,卷:vol-6cbbbea3]
我需要这样的东西:
第一卷,35b0b5fa
第一卷,6cbbbea3
我不知道我该怎么做,我的研究对我没有帮助.
有人可以帮帮我吗?