如何添加或更改堆栈的标签?

nev*_*gqs 4 amazon-web-services aws-cloudformation

我有一个现有的 AWS CloudFormation 堆栈,并且我想向该堆栈添加一个附加标签。我完成了“更新堆栈”UI 步骤,但没有看到任何允许我更新标签的内容。

是否可以将标签添加到现有标签中,如果可以,如何添加?

小智 6

您可以通过为 aws cli 运行 update-stack 来更新现有堆栈上的标签:

$ aws cloudformation update-stack --stack-name myStack --template-body file://myCloudformationTemplate.yaml --tags='[{"Key": "Author","Value": "Me"}, {"Key": "Project", "Value": "Foo"}]'
Run Code Online (Sandbox Code Playgroud)

  • 这将覆盖现有标签,因此如果您想进行更新或添加,请务必从“describe-stacks”获取旧标签。 (2认同)