【问题标题】:How can I retry a AWS CloudFormation update if an update is already happening?如果更新已经发生,我如何重试 AWS CloudFormation 更新?
【发布时间】:2018-12-26 19:10:30
【问题描述】:

尝试实施 CI,每次提交都会触发 CFN 更新。如何检查是否正在发生更新并强制我的脚本等待或安排在将来的某个时间重试?

我看到有一个 describe-stack-events,但这给了我一个列表,而不是最近的事件。有缩短版吗?

aws cloudformation describe-stack-events --profile dev --stack-name name --max-items 1

【问题讨论】:

    标签: amazon-web-services amazon-cloudformation aws-cli


    【解决方案1】:

    找到解决方案:

    aws cloudformation wait stack-update-complete --stack-name name --profile dev
    

    更多详情请访问:https://docs.aws.amazon.com/cli/latest/reference/cloudformation/wait/index.html#cli-aws-cloudformation-wait

    【讨论】:

      【解决方案2】:

      我在测试脚本时使用的单行代码(并假设会出现故障)。它运行脚本,等待更新完成,然后返回导致问题的事件。

      aws cloudformation update-stack --stack-name name --template-body file://stack.yaml && aws cloudformation wait stack-update-complete --stack-name name || aws cloudformation describe-stack-events --stack-name name | grep -B2 -A8 CREATE_FAILED
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2022-07-08
        • 1970-01-01
        • 2015-05-06
        • 2018-09-11
        • 1970-01-01
        • 2014-03-04
        • 1970-01-01
        相关资源
        最近更新 更多