Ani*_*aje 5 bash amazon-web-services aws-cloudformation aws-cli
我有一个用例,我的 bash 脚本需要等待 AWS CloudFormation 完成创建或更新堆栈。
我发现可以使用以下命令来执行此操作:
aws cloudformation wait stack-create-complete --stack-name STACK_NAME
aws cloudformation wait stack-update-complete --stack-name STACK_NAME
Run Code Online (Sandbox Code Playgroud)
以下是脚本的片段 -
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
Run Code Online (Sandbox Code Playgroud)
但我无法这样做,并且出现以下错误:
{
"StackId": "arn:aws:cloudformation:ap-southeast-1:someAwsAcId:stack/someStackName/xxxx-xxx-xx-xxx-xxxxx"
}
Waiter StackCreateComplete failed: Waiter encountered a terminal failure state
Run Code Online (Sandbox Code Playgroud)
脚本没有等待,而是转到下一行,导致事情中断。
Mar*_*cin -1
您正在等待堆栈更新完成,它等待:
等待堆栈状态为 UPDATE_COMPLETE。
但是,您正在创建堆栈,而不是更新它。因此,您应该等待stack-create-complete:
等待堆栈状态为 CREATE_COMPLETE。
| 归档时间: |
|
| 查看次数: |
6970 次 |
| 最近记录: |