CDK tag manager vs Cloudformation stack tags

1

Hi all

What's the difference between CDK tag manager & Cloudformation stack tags?

"I understand the technical differences, but i’m curious why cdk had to invent a new solution when cloudformation api already supported automatic tagging of all resources. it makes me think there are some pros and cons with both strategies that we should be aware of. otherwise, i’m not sure why the cdk tag manager feature even exists."

AWS
jmbaws
질문됨 4년 전1809회 조회
1개 답변
2
수락된 답변

With CloudFormation, tags are applied at the Resource level. In other words, if you want to apply a tag on all the supported resources in your stack, you have to specify the tag's key and value each time for each resource as a property. This is quite repetitive and verbose, and also error-prone. Alternatively, you can supply a --tags command line argument or API argument to create-stack or CreateStack, but this is outside the template context and applies to all resources, which limits flexibility.

Imagine, too, that you need to add, modify, or remove a tag on each supported resource in a stack template. That's an O(n) operation on the template on every resource, and again is error-prone.

With CDK, on the other hand, tagging can be an automated recursive operation. By tagging a higher level construct, like a Stack, all of its children automatically inherit the tag. You can also apply the tag only to other constructs, which may consist of multiple resources. Modifications are simple; just add, remove, or modify the tag at that level. And CDK knows which resource types are taggable and which aren't, so you can avoid running into unsupported-tag errors. You can also exclude certain resource types from being tagged if you like.

AWS
전문가
답변함 4년 전
profile picture
전문가
검토됨 6일 전
profile picture
전문가
검토됨 한 달 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인