【问题标题】:Assign tags to the particular resource within CloudFormation template将标签分配给 CloudFormation 模板中的特定资源
【发布时间】:2018-03-17 03:05:45
【问题描述】:

我想为我的CloudFormation 模板中的特定资源分配一些标签。比方说,我想为VPNGateway 这样做。我在模板设计器中没有看到任何特定的表单,所以我想我应该在 JSON 模板描述中手动添加一个适当的键值。

假设这个VPNGateway 的模板块看起来像:

   "XXXXXX": {
            "Type": "AWS::EC2::VPNGateway",
            "Properties": {},
            "Metadata": {
                "AWS::CloudFormation::Designer": {
                    "id": "xxxxx-yyyy-zzzzz"
                }
            }
        }

我应该在哪里放置标签信息?例如,我想添加带有键“test:key”和值“test:value”的标签。

【问题讨论】:

    标签: amazon-web-services amazon-cloudformation


    【解决方案1】:

    应该在Properties 块中完成:

            "Properties": {
                "Tags": [
                    {
                        "Key": "test:key",
                        "Value": "test:value"
                    }
                ]
            },
    

    【讨论】:

    • 您的自我回答胜过我的回答,但您也可以在 AWS 上查找每种资源类型的模板:here's EC2 VPNGateway's
    • 好的,如果您使用附加信息扩展我的答案,那就太好了。很抱歉我打败了你,我刚刚找到了这个解决方案。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-01-04
    • 2017-07-15
    • 2021-04-22
    • 2012-07-23
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多