CloudFormation nested stack name

醉酒当歌 提交于 2021-02-07 12:51:09

问题


I need to set nested stack name explicitly in a CloudFormation template, but don't see such option in AWS documentation. Is there way to achieve this? I can specify stack name, when running a parent stack, but all nested stacks, got a randomly generated stack name, based on a resource name created, like:

VPC: Type: AWS::CloudFormation::Stack Properties: TemplateURL: https://s3-eu-west-1.amazonaws.com/cf-templates-wtmg/vpc.yaml Parameters: EnvironmentName: !Ref AWS::StackName

Which will generate nested stack name in form parent_stack_name-VPC-random_hash.


回答1:


Yes. I was looking for the same thing also but currently it's not available.

I think the reason of you wanted a specific stack name is to use it for output referral?

What you can do/I did was:

1) For those in the same parent stack, you need to output from nested stack and then refer directly from the stack like !GetAtt NestedStack1.Outputs.Output1

2) For those which are outside for parent stack, you will need to output twice. Once in the nested stack and once in the parent stack. Then you can refer to the parent stack output.

Hope this will help.



来源:https://stackoverflow.com/questions/44697719/cloudformation-nested-stack-name

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!