[英]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.