aws cloudformation 通过 LogicalResourceId 描述堆栈资源查询
aws cloudformation describe-stack-resources query by LogicalResourceId
我正在尝试使用 aws 命令行检索堆栈 PhysicalResourceId。
$ aws cloudformation describe-stack-resources \
--stack-name test-app-prometheus \
--query 'StackResources[?LogicalResourceId=="PrometheusAutoScalingGroup"]'
我期待这个 return:
[
{
"ResourceStatus": "...",
"LogicalResourceId": "...",
"StackName": "test-app-prometheus",
"StackId": "...",
"PhysicalResourceId": "test-app-prometheus-PrometheusAutoScalingGroup-...",
"ResourceType": "AWS::AutoScaling::AutoScalingGroup",
"Timestamp": "2016-11-08T15:17:23.567Z"
}
]
然而,它 return 是一个空数组。
[]
运行 没有查询的命令,我可以看到资源。 运行命令:
$ aws cloudformation describe-stack-resources \
--stack-name test-app-prometheus \
--query 'StackResources[*].LogicalResourceId' \
| grep PrometheusAutoScalingGroup
"PrometheusAutoScalingGroup",
表示资源存在。
怎么样:
$ aws cloudformation describe-stack-resources \
--stack-name test-app-prometheus \
--logical-resource-id PrometheusAutoScalingGroup
我正在尝试使用 aws 命令行检索堆栈 PhysicalResourceId。
$ aws cloudformation describe-stack-resources \
--stack-name test-app-prometheus \
--query 'StackResources[?LogicalResourceId=="PrometheusAutoScalingGroup"]'
我期待这个 return:
[
{
"ResourceStatus": "...",
"LogicalResourceId": "...",
"StackName": "test-app-prometheus",
"StackId": "...",
"PhysicalResourceId": "test-app-prometheus-PrometheusAutoScalingGroup-...",
"ResourceType": "AWS::AutoScaling::AutoScalingGroup",
"Timestamp": "2016-11-08T15:17:23.567Z"
}
]
然而,它 return 是一个空数组。
[]
运行 没有查询的命令,我可以看到资源。 运行命令:
$ aws cloudformation describe-stack-resources \
--stack-name test-app-prometheus \
--query 'StackResources[*].LogicalResourceId' \
| grep PrometheusAutoScalingGroup
"PrometheusAutoScalingGroup",
表示资源存在。
怎么样:
$ aws cloudformation describe-stack-resources \
--stack-name test-app-prometheus \
--logical-resource-id PrometheusAutoScalingGroup