简体   繁体   中英

aws cloudformation describe-stacks --query

I am trying to write a query for a specific stack. It looks like this:

$ aws cloudformation describe-stacks --region $AWS_REGION --profile $AWS_PROFILE --stack-name MyStack --query 'Stacks[?StackName == "MyStack"]'
[]

As you can see the output is an empty array. On the other hand:

$ aws cloudformation describe-stacks --region $AWS_REGION --profile $AWS_PROFILE --stack-name MyStack --query 'Stacks[0]'
{
   // the output
}

What am I missing in my query version? How do I fix it?

Enclose the value in backquotes:

--query 'Stacks[?StackName == `MyStack`]'

Filtering AWS CLI output - AWS Command Line Interface

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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