【发布时间】:2020-11-09 12:11:44
【问题描述】:
我有一个用例,我的 bash 脚本需要等到 AWS CloudFormation 完成创建或更新堆栈。
我发现可以使用以下命令:
aws cloudformation wait stack-create-complete --stack-name STACK_NAME
aws cloudformation wait stack-update-complete --stack-name STACK_NAME
以下是脚本的 sn-p -
echo "Creating stack ..."
aws cloudformation create-stack --stack-name $STACK_NAME \
--parameters ParameterKey=Environment,ParameterValue=Development \
--template-body file://someCfScript.yaml \
--capabilities CAPABILITY_AUTO_EXPAND --profile someProfileName
aws cloudformation wait stack-create-complete --stack-name $STACK_NAME
但我无法这样做,我收到以下错误:
{
"StackId": "arn:aws:cloudformation:ap-southeast-1:someAwsAcId:stack/someStackName/xxxx-xxx-xx-xxx-xxxxx"
}
Waiter StackCreateComplete failed: Waiter encountered a terminal failure state
脚本没有等待,而是转到下一行,导致事情中断。
【问题讨论】:
标签: bash amazon-web-services amazon-cloudformation aws-cli