问题描述
我想在 python(boto3) 中有一个函数来检查堆栈的状态(CREATE_IN_PROGRESS、CREATE_Failed、CREATE_COMPLETE)并打印状态,如果状态是“CREATE_COMPLETE”,则打印“堆栈输出”。>
希望你能帮助我。
丹尼尔·W。
解决方法
您可以只使用 Stack 对象:
import boto3
cfnr = boto3.resource('cloudformation')
stack = cfnr.Stack('some-stack-name')
if stack.stack_status == 'CREATE_COMPLETE':
print(stack.outputs)