gpt4 book ai didi

bash - 找不到 AWS CloudFormation 命令

转载 作者:行者123 更新时间:2023-12-03 07:41:18 26 4
gpt4 key购买 nike

我编写了这个 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')

关于bash - 找不到 AWS CloudFormation 命令,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66971093/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com