繁体   English   中英

如何将堆栈级标签添加到使用 SAM 部署的 cloudformation 堆栈

[英]How to add stack-level tags to cloudformation stack deployed using SAM

我尝试在使用 SAM 部署时将标签添加到堆栈,但它们没有显示出来。 SAM cli 命令代码可以在下面找到。

sam deploy --stack-name test-stack --resolve-image-repos --capabilities CAPABILITY_NAMED_IAM --no-fail-on-empty-changeset --template-file ./.aws-sam/build/template.yaml --resolve-s3 --tags Name=test-stack az:zone=infra

尽管向 cli 提供了 —tag 参数,但并未在 CloudFormation 堆栈中创建标签。

有人能告诉我如何将堆栈级标签添加到使用 SAM CLI 部署的 CloudFormation 堆栈吗?

我宁愿建议将它们放在samconfig.toml文件中,例如:

[default.deploy.parameters]
stack_name = "your-application"
s3_bucket = "your-s3-for-cloudformation-stuff"
s3_prefix = "your-folder-name"
...
tags = "Name=\"test-stack\" az:zone=\"infra\""

这会将标签向下传播到堆栈的所有资源(包括 CloudFormation 堆栈本身)

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM