cf_connection = boto.cloudformation.connect_to_region('us-east-1', aws_access_key_id='mykey',
aws_secret_access_key='mysecret')
resource = cf_connection.list_stack_resources(stack_id)
print resource
此列表不包含物理ID,而是提供逻辑ID和类型 另外我如何过滤此列表
CLI中提供了所有内容
"StackId": "arn:aws:cloudformation:myid",
"ResourceStatus": "CREATE_COMPLETE",
"ResourceType": "AWS::EC2::XYZ",
"Timestamp": "time",
"StackName": "mystack",
"PhysicalResourceId": "myphysical",
"LogicalResourceId": "myLogicalName"
答案 0 :(得分:0)
list_stack_resources
方法返回StackResourceSummary
个对象的列表。每个对象都具有以下属性:
您可以在列表中的每个对象上使用这些属性来获取您要查找的详细信息。
试试这段代码:
import boto.cloudformation
conn = boto.cloudformation.connect_to_region('us-east-1', ...)
resources = conn.list_stack_resources(stack_id)
for resource in resources:
print(resource.last_updated_time)
print(resource.logical_resource_id)
print(resource.physical_resource_id)
print(resource.status)
print(resource.resource_type)
告诉我你的看法。