【发布时间】:2015-06-22 12:48:14
【问题描述】:
我将 Python3 与 boto3 包一起使用,并且正在运行 describe_instances() 来描述我的所有实例。但是返回类型是字典,现在字典中有列表和其他字典。
例如,我想要做的是仅返回“InstanceId”字符串,或者如果我可以返回也不错的整个“Instances”列表。
ec2 = boto3.client(Make connection here)
response = ec2.describe_instances()
pp = pprint.PrettyPrinter(indent=2)
pp.pprint(response)
返回类型和响应代码可以在这里找到。 http://boto3.readthedocs.org/en/latest/reference/services/ec2.html#EC2.Client.describe_instances
【问题讨论】:
标签: python amazon-web-services boto3