我正在使用boto python模块来轮询amazon ec2实例,但它返回空值,
我可以使用conn.get_all_images
检索和列出图像import sys
from boto.ec2.connection import EC2Connection
conn = EC2Connection('access key','secret key')
inst = conn.get_all_instances()
for i in inst:
print i
我从python命令行尝试了它,它也有相同的结果
>>>import sys
>>>from boto.ec2.connection import EC2Connection
>>>conn = EC2Connection('access key','secret key')
>>> instances = conn.get_all_instances()
>>> instances
[]
>>>
任何想法可能是什么问题?感谢
答案 0 :(得分:1)
我正在查看错误的区域,当我使用正确的区域时修复...
regions = boto.ec2.regions(aws_access_key_id=AWS_ACCESS_KEY_ID,aws_secret_access_key=AWS_SECRET_ACCESS_KEY,is_secure=False)
eu = regions[0]
conn_eu = eu.connect(aws_access_key_id=AWS_ACCESS_KEY_ID,aws_secret_access_key=AWS_SECRET_ACCESS_KEY)
inst = conn_eu.get_all_instances()