import boto.cloudformation
conn = boto.cloudformation.connect_to_region('us-west-2') # or your favorite region
stacks = conn.describe_stacks('MyStackID')
if len(stacks) == 1:
stack = stacks[0]
else:
# Raise an exception or something because your stack isn't there
对
describe_stacks
的调用应该返回Stack
对象的列表,而不是单个StackSummary
对象。让我们通过一个完整的例子来避免混淆。首先,这样做:
此时变量
stack
是一个Stack
对象。堆栈的输出可用作stack
的outputs
属性。此属性将包含Output
对象的列表,这些对象依次具有key
、value
和description
属性。因此,这将打印所有输出:相关问题 更多 >
编程相关推荐