This is the new AWS CloudFormation Template Reference Guide. Please update your bookmarks and links. For help getting started with CloudFormation, see the AWS CloudFormation User Guide.
AWS::LanguageExtensions
transform
This topic describes how to use the AWS::LanguageExtensions transform to
enable additional functions and capabilities that are not available by default.
The AWS::LanguageExtensions is a CloudFormation macro that, when referenced in
your stack template, updates any intrinsic function defined by the transform to its resolved
value within the template when you create or update a stack using a change set.
By including this transform in your CloudFormation template, you can access additional
features, such as Fn::ForEach, which allows for more advanced operations like
iteration. You can also use intrinsic functions in places where they're typically not
allowed, such as in Ref and Fn::GetAtt functions.
Usage
To use the AWS::LanguageExtensions transform, you must declare it at the
top level of your CloudFormation template. You can't use
AWS::LanguageExtensions as a transform embedded in any other template
section.
The declaration must use the literal string AWS::LanguageExtensions as
its value. You can't use a parameter or function to specify a transform value.
Syntax
To declare this transform in your CloudFormation template, use the following syntax:
JSON
{ "Transform":"AWS::LanguageExtensions", "Resources":{...} }
YAML
Transform: AWS::LanguageExtensions Resources:...
The AWS::LanguageExtensions transform is a standalone declaration with no
additional parameters.
Support for additional functions
The AWS::LanguageExtensions transform supports the following additional
functions:
Considerations
When using the AWS::LanguageExtensions transform, keep the following
considerations in mind:
-
When you update a stack that uses the
AWS::LanguageExtensionstransform, we recommend that you don't use the Use existing template option in the CloudFormation console, or the equivalent command line option--use-previous-template. TheAWS::LanguageExtensionstransform resolves parameters to literal values during processing. When you use--use-previous-template, CloudFormation uses this processed template with the old literal values, preventing new parameter values and Systems Manager parameter updates from being applied. Instead, provide the original template to ensure parameters are re-resolved with current values. -
Short-form YAML syntax isn't supported within a template for intrinsic functions that are only available in the
AWS::LanguageExtensionstransform. Use explicit references to these functions. For example, useFn::Lengthinstead of!Length. -
The AWS SAM CLI currently doesn't support the
Fn::ForEachintrinsic function of theAWS::LanguageExtensionstransform. -
If you're using multiple transforms, use a list format. If you're using custom macros, place AWS-provided transforms after your custom macros. If you're using both the
AWS::LanguageExtensionsandAWS::Serverlesstransforms, theAWS::LanguageExtensionstransform must come before theAWS::Serverlesstransform in the list. -
Functions and attributes provided by the
AWS::LanguageExtensionstransform are only supported in theResources,Conditions, andOutputssections of your template.
Examples
The following examples show how to use the AWS::LanguageExtensions
transform to use the Fn::Length intrinsic function, defined by the
transform.
JSON
{ "AWSTemplateFormatVersion": "2010-09-09", "Transform": "AWS::LanguageExtensions", "Parameters": { "QueueList": { "Type": "CommaDelimitedList" }, "QueueNameParam": { "Description": "Name for your SQS queue", "Type": "String" } }, "Resources": { "Queue": { "Type": "AWS::SQS::Queue", "Properties": { "QueueName": { "Ref": "QueueNameParam" }, "DelaySeconds": { "Fn::Length": { "Ref": "QueueList" } } } } } }
YAML
AWSTemplateFormatVersion: 2010-09-09 Transform: AWS::LanguageExtensions Parameters: QueueList: Type: CommaDelimitedList QueueNameParam: Description: Name for your SQS queue Type: String Resources: Queue: Type: AWS::SQS::Queue Properties: QueueName: !Ref QueueNameParam DelaySeconds: 'Fn::Length': !Ref QueueList
Related resources
For more examples, see the following topics.
For general information about using macros, see Perform custom processing on CloudFormation templates with template macros in the AWS CloudFormation User Guide.