【问题标题】:aws cloudformation describe-stack-resources query by LogicalResourceId通过 LogicalResourceId 查询 aws cloudformation describe-stack-resources
【发布时间】:2017-03-22 09:47:15
【问题描述】:

我正在尝试使用 aws 命令行检索堆栈 PhysicalResourceId。

$ aws cloudformation describe-stack-resources \
      --stack-name test-app-prometheus \
      --query 'StackResources[?LogicalResourceId=="PrometheusAutoScalingGroup"]' 

我期待这会返回:

[
   {
        "ResourceStatus": "...",
        "LogicalResourceId": "...",
        "StackName": "test-app-prometheus",
        "StackId": "...",
        "PhysicalResourceId": "test-app-prometheus-PrometheusAutoScalingGroup-...",
        "ResourceType": "AWS::AutoScaling::AutoScalingGroup",
        "Timestamp": "2016-11-08T15:17:23.567Z"
   }
]

但是它返回的是一个空数组。

[]

在没有查询的情况下运行命令,我可以看到资源。运行命令:

$ aws cloudformation describe-stack-resources \
    --stack-name test-app-prometheus \
    --query 'StackResources[*].LogicalResourceId' \
 | grep PrometheusAutoScalingGroup
"PrometheusAutoScalingGroup",

表明资源存在。

【问题讨论】:

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


    【解决方案1】:

    怎么样:

    $ aws cloudformation describe-stack-resources \
          --stack-name test-app-prometheus \
          --logical-resource-id PrometheusAutoScalingGroup
    

    CloudFormation and the New AWS CLI

    【讨论】:

    • 完全错过了。谢谢。
    猜你喜欢
    • 1970-01-01
    • 2017-05-28
    • 2019-04-05
    • 1970-01-01
    • 1970-01-01
    • 2013-02-17
    • 2020-07-07
    • 2020-07-11
    • 2021-12-11
    相关资源
    最近更新 更多