繁体   English   中英

CloudFormation 嵌套堆栈名称

[英]CloudFormation nested stack name

我需要在 CloudFormation 模板中明确设置嵌套堆栈名称,但在AWS 文档中看不到此类选项。 有没有办法做到这一点? 我可以在运行父堆栈时指定堆栈名称,但所有嵌套堆栈都会根据创建的资源名称获得一个随机生成的堆栈名称,例如:

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

这将以parent_stack_name-VPC-random_hash形式生成嵌套堆栈名称。

是。 我也在寻找相同的东西,但目前它还没有。

我想你想要一个特定的堆栈名称的原因是用它来输出引用?

你能做什么/我做的是:

1)对于同一父堆栈中的那些,你需要从嵌套堆栈输出,然后直接从堆栈中引用,如!GetAtt NestedStack1.outputs.Output1

2)对于父堆栈外的那些,你需要输出两次。 一旦进入嵌套堆栈,一次进入父堆栈。 然后您可以参考父堆栈输出。

希望这会有所帮助。

我今天遇到了同样的事情。

来自官方 AWS 文档,支持此问题的原始答案: You can add output values from a nested stack within the containing template. You use the GetAtt function with the nested stack's logical name and the name of the output value in the nested stack in the format Outputs.NestedStackOutputName. You can add output values from a nested stack within the containing template. You use the GetAtt function with the nested stack's logical name and the name of the output value in the nested stack in the format Outputs.NestedStackOutputName.

https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-stack.html

看起来我们仍然不能更容易地引用堆栈名称。 此页面上问题的第一个答案仍然有效。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM