Cloudformation tagging for cost management

0

Can you tag an existing cloudformation resource in the console or cli?

2 Answers
1

Yes, you can. But it would be best if you updated the cloudformation template to include the tags on the resource(s) and updated the stack with the updated template.

profile pictureAWS
EXPERT
kentrad
answered 2 years ago
0

If you want to have unique tag keys or values per resource then the right the way to include tags into template as Kentrad said. But if you want to have tags applied to all resources of the stack, it is much easier to apply tags to stack (via console or cli) and then Cloudformation will automatically apply the tags for all resources. You can also change/add/remove tags of exiting stack by doing an stack update with new tags. Here is an example how to do this https://carriagereturn.nl/aws/cloudformation/tag/2018/04/24/cloudformationtags.html

PS. There is a small caveat here, some Cloudformation resources have faulty implementation causing resource to be replaced for tag update. Just pay attention that "Replacement = False" for all resources before applying an update. There are rare cases but TGW is one such example, https://github.com/aws-cloudformation/aws-cloudformation-resource-providers-transitgateway/issues/124

profile picture
EXPERT
Kallu
answered 2 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions