简体   繁体   English

未找到 Aws CloudFormation 命令

[英]Aws CloudFormation command not found

I have written this bash command to extract the output of this json:我写了这个 bash 命令来提取这个 json 的 output:

{
    "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
        }
    ]
}

the code the I wrote is this: while:我写的代码是这样的:而:

          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

but I receive an error that says that the command cloudformation not found但我收到一条错误消息,提示找不到命令 cloudformation

You have to add to the command this "$()":您必须将这个“$()”添加到命令中:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM