سؤال

I have a list of AMIs, which I got by creating a boto connection:

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

I want to be able to see the properties of these AMIs. Properties such as their descriptions, names and their image ids.

هل كانت مفيدة؟

المحلول 2

After looking at image.py, I realised I can just do: image.id to get image id and image.description to get image description

نصائح أخرى

Here are all of the properties of the boto.ec2.image.Image object per Print all properties of a Python Class:

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)

(Or, to print the values as well, you can use):

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

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top