AWS CLI - 获取名称以字符串开头的所有 CloudFormation 堆栈

AWS CLI - Get all CloudFormation stacks that have a name that starts with string

我应该使用什么查询来获取以特定字符串开头的所有 CloudFormation 堆栈?

我试过以下查询,但它总是 return 是一个空数组:

aws cloudformation describe-stacks --no-paginate --query "Stacks[?StackName!='null']|[?starts_with(StackName,'HD-') == 'true']"

我们帐户中的所有堆栈都以 "HD-" 开头,因此这应该 return 与

相同
aws cloudformation describe-stacks --no-paginate

但是 returns

[]

这个命令工作正常:

aws cloudformation describe-stacks --no-paginate --query \
  'Stacks[?StackName!=`null`]|[?contains(StackName, `Release`) == `true`].StackName'

您似乎需要在查询中使用 ` 而不是 '..