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


The optional Transform section specifies a transform that AWS CloudFormation uses to process your template. A transform is a specific version of the AWS Serverless Application Model (AWS SAM). This model defines the AWS SAM syntax that you can use and how AWS CloudFormation processes it. For more information about serverless applications and the model, see Deploying Lambda-based Applications in the AWS Lambda Developer Guide.

Use a transform to simplify template authoring for serverless applications. For example, the following template uses AWS SAM syntax to simplify the declaration of an AWS Lambda function and its execution role.

Transform: AWS::Serverless-2016-10-31
    Type: AWS::Serverless::Function
      Handler: index.handler
      Runtime: nodejs4.3
      CodeUri: 's3://testBucket/'

When the template is submitted, AWS CloudFormation expands the AWS SAM syntax, as defined by the transform. The processed template expands the AWS::Serverless::Function resource, declaring an AWS Lambda function and an execution role.

  "Resources": {
    "MyServerlessFunctionLogicalID": {
      "Type": "AWS::Lambda::Function",
      "Properties": {
        "Handler": "index.handler",
        "Code": {
          "S3Bucket": "testBucket",
          "S3Key": ""
        "Role": {
          "Fn::GetAtt": ["FunctionNameRole", "Arn"]
        "Runtime": "nodejs4.3"
    "FunctionNameRole": {
      "Type": "AWS::IAM::Role",
      "Properties": {
        "ManagedPolicyArns": ["arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole"],
        "AssumeRolePolicyDocument": {
          "Version": "2012-10-17",
          "Statement": [{
            "Action": ["sts:AssumeRole"],
            "Effect": "Allow",
            "Principal": {
              "Service": [""]

AWS CloudFormation uses the processed template to create or update a stack. If you don't specify a transform value, AWS CloudFormation doesn't process your template, and the AWS SAM syntax fails template validation.


The value for the transform declaration must be a literal string. You cannot use a parameter or function to specify a transform value. The following snippet is an example of a transform declaration:


"Transform" : "AWS::Serverless-2016-10-31"


Transform: "AWS::Serverless-2016-10-31"

Template Stage

The stage of a template indicates whether the template is the original user-submitted template or a one where AWS CloudFormation has processed the transforms. The original template is the one that users submitted to create or update the stack. The processed template is the template AWS CloudFormation used to create or update the stack after processing the transform(s). Use the processed template for troubleshooting stack issues. If a stack doesn't include transforms, the original and processed templates are identical.

You can use the AWS CloudFormation console or AWS CLI to see the stage of a stack's template.

Working with Stacks that Contain Transforms

To create or update a stack with transforms, you must create a change set, and then execute it. A change set describes the actions AWS CloudFormation will take based on the processed template. During processing, AWS CloudFormation translates AWS SAM syntax into syntax that is defined by the transform. Processing can add multiples resources that you might not be aware of. For example, the specialized AWS::Serverless::Function resource adds an AWS Identity and Access Management (IAM) execution role and a Lambda function.

To ensure that you're aware of all of the changes introduced by transforms, AWS CloudFormation requires you to use change sets. After you review the change set, execute it to apply the changes or create another one.


A transform can add IAM resources to your template. For these resources, AWS CloudFormation requires you to acknowledge their capabilities. Because AWS CloudFormation can't know which resources are added before processing your template, you might need to acknowledge IAM capabilities when you create the change set, depending on whether your transforms contain IAM resources. That way, when you execute the change set, AWS CloudFormation has the necessary capabilities when creating IAM resources.

If you use the AWS CLI, you can use the package and deploy commands to reduce the number of steps for launching stacks with transforms. For more information, see Deploying Lambda-based Applications in the AWS Lambda Developer Guide.