我有一个描述图像的boto3脚本。
但是,我想自定义脚本,以便它仅向我显示标记的值,即AMI的名称。
当前显示:
([{u'Value': 'NAME OF AMI',u'Key': 'Name'}],'ami-xxxxxxxxxxxxxx','available')
但是我想要这样的东西:
**Name :'NAME OF AMI','available'**
这是我的剧本:
import boto3
import sys
import pprint
ec2 = boto3.resource('ec2')
client = boto3.client('ec2')
response = client.describe_images(Owners=['self'])
for ami in response['Images']:
print (ami['Tags'],ami['ImageId'],ami['State'])