2012-08-22 70 views
2

我的AMI的列表,其中我通過創建一個博託連接:獲得AWS AMI性能

conn_eu = boto.ec2.connect_to_region('eu-west-1') 
images = conn_eu.get_all_images(owners=['me']) 

我希望能夠看到這些的AMI的屬性。諸如其描述,名稱和圖像ID等屬性。

回答

2

看着image.py後,我意識到我可以這樣做: image.id獲得圖片ID 和image.description獲得圖像描述

2

這裏是所有boto.ec2的性能。每Print all properties of a Python Class image.Image對象:

from boto.ec2 import connect_to_region 
ec2_connection = connect_to_region("us-west-2", 
      aws_access_key_id="...", 
      aws_secret_access_key="...") 
images = ec2_connection.get_all_images(image_ids=["ami-xxxxxxxxx"]) 
for k in vars(images[0]).keys(): 
     print "{0}".format(k) 

(或者,要打印值,以及,你可以使用):

for k,v in vars(images[0]).iteritems(): 
     print "{0}:{1}".format(k,v) 

root_device_type ramdisk_id id owner_alias billing_products tags platform state location type virtualization_type sriov_net_support architecture description block_device_mapping kernel_id owner_id is_public instance_lifecycle creationDate name hypervisor region item connection root_device_name ownerId product_codes