Skip to main content

Tags

You specify stack tags with the tags property. CloudFormation automatically adds the tags to each resource in the stack that supports tagging.

Examples

Setting tags:

tags:
foo: bar
code: 123
backups: true

Usage in configuration

tags property can be defined in:

  • stack group configuration files
  • blueprint configuration files
  • stack configuration files

Stack group config file

When data property is defined in a stack group configuration file:

  • its value is merged with the value inherited from the parent stack group
  • its value is inherited by stack groups and stacks that belong under the stack group

Blueprint config file

When data property is defined in a blueprint configuration file:

  • its value is merged with the value inherited from the parent stack group
  • its value is inherited by stacks that extend the blueprint

Stack config file

When data property is defined in a stack configuration file:

  • if the stack extends a blueprint, its value is merged with the value inherited from the blueprint
  • otherwise, its value is merged with the value inherited from the parent stack group

Configuration merging

Configuration merging happens when a stack group, blueprint or stack inherits tags property but also defines tags property of its own.

Tags are merged recursively.

Requirements

The tags property must satisfy these requirements:

  • Each tag key must be a string
  • Each tag value must be a string, a number or a boolean