3

boto接続を作成して取得したAMIのリストがあります。

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

これらのAMIのプロパティを確認できるようにしたいと思います。説明、名前、画像IDなどのプロパティ。

4

2 に答える 2

2

image.pyを見た後、私は次のことができることに気付きました:image.idは画像IDを取得し、image.descriptionは画像の説明を取得します

于 2012-08-22T11:46:19.650 に答える
2

Pythonクラスのすべてのプロパティを出力するごとのboto.ec2.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

于 2015-12-28T21:38:29.940 に答える