如何将标签添加到AWS-CDK构造 [英] How to add a tag to an AWS-CDK construct
本文介绍了如何将标签添加到AWS-CDK构造的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何将标签添加到特定于AWS-CDK的构造中,或者甚至向堆栈中创建的所有资源添加更好的标签定义?
How to add a tag to an AWS-CDK specific construct or even better one tag definition to all ressources created within the stack?
推荐答案
根据aws-cdk文档,您可以将标记添加到所有构造/资源.标签将继承到同一树"中的构造.太酷了.
According to aws-cdk doc you can add a tag to all constructs/ressources. Tags will inherits to constructs within same "tree". That's pretty cool.
使用基于Java的aws-cdk的示例:
Example using aws-cdk based on java:
MyStack stack = new MyStack(app, "nameOfStack");
Tag.add(stack, "tag_foo", "tag_foo");
查看全文