![](/img/trans.png)
[英]AWS cloud formation Template- providing Tags for the stack in the template
[英]set stack level tags in a cloudformation template- not in a nested stack
对如何做到这一点或是否可能感到有些困惑。
这不是嵌套堆栈。 我想在我的 CF 模板中设置适用于模板中所有资源的标签。 AWS::CloudFormation::Stack 资源可以做到这一点,但我不需要/想要嵌套堆栈,我只有一个堆栈和一个模板。
使用命令deploy
和--tags
:
aws cloudformation deploy \
--template-file template.yaml \
--stack-name MyStack \
--tags Key1=Value1 Key2=Value2
文档:
--tags (list) 与创建或更新的堆栈相关联的标签列表。 如果资源支持,AWS CloudFormation 还会将这些标签传播到堆栈中的资源。 语法:TagKey1=TagValue1 TagKey2=TagValue2 ...
您可以通过一种解决方法来解决该问题。 您可以创建另一个仅包含“AWS::CloudFormation::Stack”资源的 CF 模板。 在参数中,提供所需的标签,并在“TemplateURL”属性中,提供指定要创建为资源的堆栈的模板的 URL。 请注意,模板必须存储在 Amazon S3 存储桶中,因此 URL 必须采用以下格式: https : //s3.amazonaws.com/.../TemplateName.extension
有关更多详细信息: https : //docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-stack.html#cfn-cloudformation-stack-templateurl
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.