amazon-web-services - aws cloudformation 描述堆栈 --query

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

我正在尝试为特定堆栈编写查询。它看起来像这样:

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

如您所见,输出是一个空数组。另一方面:

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

我的查询版本中缺少什么?我该如何修复它?

最佳答案

将值括在反引号中:

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

Filtering AWS CLI output - AWS Command Line Interface

关于amazon-web-services - aws cloudformation 描述堆栈 --query,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/75239201/

相关文章:

aws-lambda - SAM 可以创建 s3 存储桶来存储 lambda 函数代码吗?

amazon-web-services - 如何解决 AWS CloudFormation 不一致的属性 AttributeDefinitions?

amazon-web-services - 适用于 IaC 的 AWS CDK 与 SDK

json - 将变量传递给 aws cli 内联 json

security - 测试 CloudFormation 的安全气味

python-3.x - 在 Elastic Beanstalk 上部署 Flask 应用程序 : No module named 'application'

JavaFX Gradle 构建错误,java.util.zip.ZipException : duplicate entry: META-INF/LICENSE

amazon-web-services - 从 Python 将数据流式传输到 AWS Kinesis Firehose 的问题

python-3.x - 无法卸载 AWS CLI : Cannot uninstall requirement awscli, 未安装

bash - aws cli - 在 bash 脚本中下载 rds postgres 日志