描述嵌套CloudFormation堆栈资源的正确方法是什么?

时间:2016-09-08 20:16:51

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

我们有一个CloudFormation脚本,它有四个嵌套堆栈。我试图描述那些嵌套堆栈的资源。但是,当I describe-stack-resources具有嵌套堆栈之一的物理ID时,它只返回“父”堆栈(谁的资源只是嵌套堆栈)。此行为在JavaScript SDK和AWS CLI中是一致的。

我这样做了吗?这是一个错误吗?有解决方法吗?

示例AWS CLI请求:

(注意:请求的物理资源ID是返回的第二个)

aws cloudformation describe-stack-resources --physical-resource-id arn:aws:cloudformation:us-west-2:58701038XXXX:stack/pelorus-vk-DatabaseStack-W12E3SAXPG6K/b0197770-7519-11e6-9518-50aXXXXXca9a
{
    "StackResources": [
        {
            "StackId": "arn:aws:cloudformation:us-west-2:58701038XXXX:stack/pelorus-vk/f93b5960-7518-11e6-8939-XXXXX0f2ad1e",
            "ResourceStatus": "UPDATE_COMPLETE",
            "ResourceType": "AWS::CloudFormation::Stack",
            "Timestamp": "2016-09-07T16:53:11.305Z",
            "StackName": "pelorus-vk",
            "PhysicalResourceId": "arn:aws:cloudformation:us-west-2:58701038XXXX:stack/pelorus-vk-DashboardStack-1GDLBCAFE6U3F/fb9c53d0-7518-11e6-bd48-50dXXXXX84d2",
            "LogicalResourceId": "DashboardStack"
        },
        {
            "StackId": "arn:aws:cloudformation:us-west-2:58701038XXXX:stack/pelorus-vk/f93b5960-7518-11e6-8939-XXXXX0f2ad1e",
            "ResourceStatus": "CREATE_COMPLETE",
            "ResourceType": "AWS::CloudFormation::Stack",
            "Timestamp": "2016-09-07T16:53:04.667Z",
            "StackName": "pelorus-vk",
            "PhysicalResourceId": "arn:aws:cloudformation:us-west-2:58701038XXXX:stack/pelorus-vk-DatabaseStack-W12E3SAXPG6K/b0197770-7519-11e6-9518-50aXXXXXca9a",
            "LogicalResourceId": "DatabaseStack"
        },
        {
            "StackId": "arn:aws:cloudformation:us-west-2:58701038XXXX:stack/pelorus-vk/f93b5960-7518-11e6-8939-XXXXX0f2ad1e",
            "ResourceStatus": "UPDATE_COMPLETE",
            "ResourceType": "AWS::CloudFormation::Stack",
            "Timestamp": "2016-09-07T16:53:13.293Z",
            "StackName": "pelorus-vk",
            "PhysicalResourceId": "arn:aws:cloudformation:us-west-2:58701038XXXX:stack/pelorus-vk-EventProcessingStack-GB814FASNNV4/fb8f3470-7518-11e6-a2c5-503XXXXXadae",
            "LogicalResourceId": "EventProcessingStack"
        },
        {
            "StackId": "arn:aws:cloudformation:us-west-2:587010381366:stack/pelorus-vk/f93b5960-7518-11e6-8939-XXXXX0f2ad1e",
            "ResourceStatus": "UPDATE_COMPLETE",
            "ResourceType": "AWS::CloudFormation::Stack",
            "Timestamp": "2016-09-07T16:53:11.496Z",
            "StackName": "pelorus-vk",
            "PhysicalResourceId": "arn:aws:cloudformation:us-west-2:587010381366:stack/pelorus-vk-StreamStack-NAA3DJMELCFG/04990c30-7519-11e6-934e-50aXXXXX12f2",
            "LogicalResourceId": "StreamStack"
        }
    ]
}

1 个答案:

答案 0 :(得分:1)

潜在的解决方法:使用--physical-resource-id替换--stack-name会导致我预期的行为,即使我提供了物理ID