AWS CloudFormation
User Guide (API Version 2010-05-15)

The AWS Documentation website is getting a new look!
Try it now and let us know what you think. Switch to the new look >>

You can return to the original look by selecting English in the language selector above.

Fn::Transform

The intrinsic function Fn::Transform specifies a macro to perform custom processing on part of a stack template. Macros enable you to perform custom processing on templates, from simple actions like find-and-replace operations to extensive transformations of entire templates. For more information, see Using AWS CloudFormation Macros to Perform Custom Processing on Templates.

You can also use Fn::Transform to call the AWS::Include Transform transform, which is a macro hosted by AWS CloudFormation.

Declaration

JSON

{ "Fn::Transform" : { "Name" : macro name, "Parameters" : {key : value, ... } } }

YAML

Syntax for the full function name:

Fn::Transform: Name : macro name Parameters : Key : value

Syntax for the short form:

!Transform { "Name" : macro name, "Parameters" : {key : value, ... } }

Parameters

Name

The name of the macro you want to perform the processing.

Parameters

The list parameters, specified as key-value pairs, to pass to the macro.

Return Value

The processed template snippet to be included in the processed stack template.

Examples

The following example calls the AWS::Include transform, specifying that the location to retrieve a template snippet from is passed in the InputValue parameter.

JSON

{ "Fn::Transform" : { "Name" : "AWS::Include", "Parameters" : { "Location" : { "Ref" : "InputValue" } } } }

YAML

'Fn::Transform': Name: 'AWS::Include' Parameters: {Location: {Ref: InputValue}}

The following example calls the AWS::Include transform, specifying that the location to retrieve a template snippet from is located in the RegionMap mapping, under the key us-east-1 and nested key s3Location.

JSON

{ "Fn::Transform" : { "Name" : "AWS::Include", "Parameters" : { "Location" : {"Fn::FindInMap" : ["RegionMap", "us-east-1", "s3Location"] } } } }

YAML

'Fn::Transform': Name: 'AWS::Include' Parameters: {Location: {'Fn::FindInMap': [RegionMap, us-east-1, s3Location]}}

Supported Functions

None. AWS CloudFormation passes any intrinsic function calls included in Fn::Transform to the specified macro as literal strings. For more information, see AWS CloudFormation Macro Function Interface.