微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

未找到 Aws CloudFormation 命令

如何解决未找到 Aws CloudFormation 命令

我写了这个 bash 命令来提取这个 json 的输出

{
    "Stacks":  [
        {
            "StackId": "arn:aws:cloudformation:us-east-1:123456789012:stack/myteststack/466df9e0-0dff-08e3-8e2f-5088487c4896","Description": "AWS CloudFormation Sample Template S3_Bucket: Sample template showing how to create a publicly accessible S3 bucket. **WARNING** This template creates an S3 bucket. You will be billed for the AWS resources used if you create a stack from this template.","Tags": [],"Outputs": [
                {
                    "Description": "Name of S3 bucket to hold website content","OutputKey": "BucketName","OutputValue": "myteststack-s3bucket-jssofi1zie2w"
                }
            ],"StackStatusReason": null,"CreationTime": "2013-08-23T01:02:15.422Z","Capabilities": [],"StackName": "myteststack","StackStatus": "CREATE_COMPLETE","disableRollback": false
        }
    ]
}

我写的代码是这样的: 同时:

          do
                status=aws cloudformation describe-stacks --region $REGION --stack-name $stack_name | jq --raw-output '.Stacks[0].StackStatus' 
                echo $status 
                if [[ $status == "UPDATE_ROLLBACK_COMPLETE" ]]; then
                      echo "Status is in ROLLBACK check errors"
                      exit 1
                else 
                      if [[ $status == "UPDATE_COMPLETE" ]]; then
                            break
                      fi
                fi
          echo Stack updating is finishing 
          done

但我收到一条错误消息,提示未找到命令 cloudformation

解决方法

您必须在命令中添加此“$()”:

status=$(aws cloudformation describe-stacks --region $REGION --stack-name $stack_name | jq --raw-output '.Stacks[0].StackStatus')

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。