Perform custom processing on CloudFormation templates with template macros - AWS CloudFormation

Perform custom processing on CloudFormation templates with template macros

With macros, you can perform custom processing on templates, from simple actions like find-and-replace operations to extensive transformations of entire templates.

To get an idea of the breadth of possibilities, consider the AWS::Include and AWS::Serverless transforms, which are macros hosted by CloudFormation:

Billing

When a macro runs, the owner of the Lambda function is billed for any charges related to the execution of that function.

The AWS::Serverless transform and AWS::Include transform transforms are macros hosted by CloudFormation. There is no charge for using them.

Macro examples

In addition to the examples in this section, you can find example macros, including source code and templates, in our GitHub repository. These examples are provided 'as-is' for instructional purposes.