2012-08-22 10 views
2

내가이 BOTO 연결을 만들어 가지고 AMI를의 목록이 : 나는 이러한 AMI를의 속성을 볼 수 있도록하려면얻기 AWS AMI 속성

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

합니다. 설명, 이름 및 이미지 ID와 같은 등록 정보

답변

2

image.py보고 후, 나는 깨달았다 내가 할 단지 수 있습니다 image.id를 이미지 설명을

2

를 얻기 위해 이미지 ID 및 image.description를 얻기 위해 여기 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