Show / Hide Table of Contents

Macro

The Macro declaration registers a CloudFormation Macro for the deployment tier. The handler must be a Lambda function. Once deployed, the macro is available to all subsequent module deployments.

WARNING: Due to a limitation in the Fn::Transform function, it is not possible to namespace macros to a deployment tier. Consequently, macros are defined globally for the entire account, across all deployment tiers.

Syntax

Macro: String
Description: String
Handler: String

Properties

Description

The Description attribute specifies the description of the module's output variable.

Required: No

Type: String

Handler

The Handler attribute specifies the name of a function.

Required: Yes

Type: String

Macro

The Macro attribute specifies the name of the macro. Macros are globally defined per deployment tier.

Required: Yes

Type: String

Examples

Multiple macro definition using the same Lambda function

- Macro: ToUpper
  Description: CloudFormation macro for converting a string to uppercase
  Handler: StringOpFunction

- Macro: ToLower
  Description: CloudFormation macro for converting a string to uppercase
  Handler: StringOpFunction

- Function: StringOpFunction
  Memory: 128
  Timeout: 15
In This Article
Back to top Generated by DocFX