Reuse list of CloudFormation tags

后端 未结 2 614
终归单人心
终归单人心 2021-02-13 09:49

I have a rather complex set of CloudFormation templates that I use for provisioning the different environments of our infrastructure. However I recently got the request to tag t

2条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-02-13 10:23

    You can easily reuse tags if you don't pass them to the template but instead reference them during deployment. The tags will be propagated to all ressources of the stack. A command similar to the one below might meet your needs:

    aws cloudformation create-stack --stack-name mystack \
    --template-body file://my_template.yaml --tags file://my_tags.json
    

    The file my_tags.json is of the format

    [
        {"Key": "mytag", "Value": "val"},
        ...
    ]
    

    Alternatively, you could deploy your stack through CodePipeline and define the tags in the template configuration

提交回复
热议问题