SAM Template Transform Preview - AWS::Serverless Transform Expander

First Published:
Last Updated:

Approximate the AWS SAM transform (AWS::Serverless-2016-10-31) entirely in your browser. Paste a SAM template and preview the expanded CloudFormation resources locally. All processing happens in your browser - your template never leaves your device.

IMPORTANT DISCLAIMER:

  • This tool is provided "AS IS" without any warranties of any kind.
  • This preview approximates SAM transform output. The actual CloudFormation produced by sam deploy may differ. Use sam deploy --guided or sam package for authoritative results.
  • Strict feature parity with the official AWS SAM Transformer is not guaranteed (e.g., complex policy templates, nested applications, custom transforms).
  • Always validate the actual deployed stack via the AWS CloudFormation console or CLI.
  • By using this tool, you accept full responsibility for any outcomes.

This tool uses client-side JavaScript for all processing. No data is transmitted to servers, no files are uploaded online, all processing happens locally in your browser. Once loaded, this tool continues to work even without an internet connection. For more details, please refer to our Web Tools Disclaimer.

Output Format:

Features

  • SAM → CloudFormation Expansion: Approximates the AWS::Serverless-2016-10-31 transform: AWS::Serverless::Function, Api, HttpApi, SimpleTable, StateMachine, and LayerVersion.
  • Event Source Expansion: Generates derived resources for Api, HttpApi, S3, SNS, SQS, DynamoDB, Kinesis, Schedule, and EventBridgeRule events (Permissions, EventSourceMappings, Events::Rule, etc.).
  • Globals Merging: Applies Globals.Function, Globals.Api, etc. to individual resources where the resource itself does not override the property.
  • Implicit API Generation: Synthesizes ServerlessRestApi / ServerlessHttpApi when RestApiId / ApiId is omitted on Function events.
  • CloudFormation Short Tags: Recognizes !Ref, !Sub, !GetAtt, !Join, !Select, !Split, !FindInMap, !If, !Equals, !And, !Or, !Not, !Base64, !Cidr, !ImportValue, !Condition, etc.
  • Policy Template Subset: Inlines common SAM policy templates: DynamoDBReadPolicy, DynamoDBCrudPolicy, S3ReadPolicy, S3CrudPolicy, SQSPollerPolicy, SNSPublishMessagePolicy. Unknown templates are flagged in resource Metadata.
  • Output Format Toggle: Switch between YAML and JSON output instantly. Long-form CloudFormation intrinsic functions (Fn::Sub, Fn::GetAtt, etc.) are emitted by default.
  • Privacy First: Pure client-side processing. Your SAM template never leaves your browser.

How to Use

  1. Either select a sample from the Sample Templates dropdown or paste your own SAM template (YAML or JSON) into the left textarea.
  2. Choose the desired Output Format (YAML or JSON).
  3. Click Transform → to expand the template into plain CloudFormation.
  4. Use Copy Output to copy the expanded template, or Download to save it as cfn-template.yaml / cfn-template.json.
  5. Toggle the Output Format radios to instantly re-serialize the last result.

Supported SAM Resources

  • AWS::Serverless::FunctionAWS::Lambda::Function + AWS::IAM::Role (basic execution + policies) + AWS::Logs::LogGroup + per-event derived resources
  • AWS::Serverless::ApiAWS::ApiGateway::RestApi + Deployment + Stage
  • AWS::Serverless::HttpApiAWS::ApiGatewayV2::Api + Stage
  • AWS::Serverless::SimpleTableAWS::DynamoDB::Table
  • AWS::Serverless::StateMachineAWS::StepFunctions::StateMachine + AWS::IAM::Role
  • AWS::Serverless::LayerVersionAWS::Lambda::LayerVersion

Important Notes

  • This tool is a preview approximation. The official AWS SAM Transformer used by sam deploy applies additional logic (deployment preferences, gradual deployments, deeper schema validation, alias/version resources, etc.) that this tool does not replicate.
  • Output uses long-form CloudFormation intrinsic functions (Fn::Sub, Fn::GetAtt, etc.) regardless of input. Short-form YAML tags (!Sub, !GetAtt) are not re-emitted.
  • AWS::Serverless::Application (nested applications) and Custom Transforms are out of scope and rendered as a generic approximation.
  • Existing buckets, queues, and topics referenced from event sources are not modified - only Lambda Permissions / EventSourceMappings are added on the Lambda side.
  • Comments in the input YAML are not preserved (CloudFormation does not support YAML comments after parsing).
  • This tool works offline once the page has been loaded.

Third-Party Libraries:


References:
Tech Blog with curated related content
Web Tools Collection

Written by Hidekazu Konishi