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
  • custom 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

Custom Stack Config File

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

  • 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