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:
-
AWS::Include transform enables you to insert boilerplate template snippets into your templates.
-
AWS::Serverless transform takes an entire template written in the AWS Serverless Application Model (AWS SAM) syntax and transforms and expands it into a compliant CloudFormation template. For more information about serverless applications and AWS SAM, see AWS Serverless Application Model Developer Guide.
Topics
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