简体   繁体   English

从CloudFormation模板标记父堆栈

[英]Tag the parent stack from a CloudFormation template

Is there a way to create tags on a CloudFormation stack from the template itself? 有没有办法从模板本身在CloudFormation堆栈上创建标签? (the parent stack, not nested stacks) (父堆栈,而不是嵌套堆栈)

We have many templates, which get updated with each new version of software. 我们有许多模板,每个新版本的软件都会更新。 Our software versions are tagged (in git), and it would be nice to see at a glance which version a particular stack was spooled up with. 我们的软件版本被标记(在git中),一眼就能看到特定堆栈被假脱机的版本。

The top-level anatomy of a template specifies 6 nested sections: 模板的顶级解剖结构指定了6个嵌套部分:

{
  "AWSTemplateFormatVersion" : "version date",

  "Description" : "JSON string",

  "Metadata" : {
    template metadata
  },

  "Parameters" : {
    set of parameters
  },

  "Mappings" : {
    set of mappings
  },

  "Conditions" : {
    set of conditions
  },

  "Resources" : {
    set of resources
  },

  "Outputs" : {
    set of outputs
  }
}

But none of those sections seem to allow for the tagging of the stack itself (hopefully I am missing something here). 但是这些部分似乎都没有允许标记堆栈本身(希望我在这里遗漏了一些东西)。

Yes, I could add a version string to the Metadata section, and that could be viewed by looking at the template for a particular stack, but tags are so much easier to work with in AWS. 是的,我可以在元数据部分添加一个版本字符串,可以通过查看特定堆栈的模板来查看,但是标签在AWS中更容易使用。 Plus it would allow much easier control over who can update/delete the stack. 此外,它可以更容易地控制谁可以更新/删除堆栈。

At the moment we do not make much use of stack tags because of this limitation. 目前,由于这种限制,我们没有充分利用堆栈标签。

This looks promising: 这很有希望:

http://docs.aws.amazon.com/cli/latest/reference/cloudformation/create-stack.html http://docs.aws.amazon.com/cli/latest/reference/cloudformation/create-stack.html

  create-stack
--stack-name <value>
...
[--tags <value>]
...

I think I've used that in the past to do about what you're talking about. 我想我过去曾经用它来做你正在谈论的事情。 This allows me to search for stacks based on tags, just like almost every other thing in the AWS world. 这允许我基于标签搜索堆栈,就像AWS世界中几乎所有其他东西一样。

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

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