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 deploymay differ. Usesam deploy --guidedorsam packagefor 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-31transform:AWS::Serverless::Function,Api,HttpApi,SimpleTable,StateMachine, andLayerVersion. - Event Source Expansion: Generates derived resources for
Api,HttpApi,S3,SNS,SQS,DynamoDB,Kinesis,Schedule, andEventBridgeRuleevents (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/ServerlessHttpApiwhenRestApiId/ApiIdis 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 resourceMetadata. - 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
- Either select a sample from the Sample Templates dropdown or paste your own SAM template (YAML or JSON) into the left textarea.
- Choose the desired Output Format (YAML or JSON).
- Click Transform → to expand the template into plain CloudFormation.
- Use Copy Output to copy the expanded template, or Download to save it as
cfn-template.yaml/cfn-template.json. - Toggle the Output Format radios to instantly re-serialize the last result.
Supported SAM Resources
- AWS::Serverless::Function →
AWS::Lambda::Function+AWS::IAM::Role(basic execution + policies) +AWS::Logs::LogGroup+ per-event derived resources - AWS::Serverless::Api →
AWS::ApiGateway::RestApi+Deployment+Stage - AWS::Serverless::HttpApi →
AWS::ApiGatewayV2::Api+Stage - AWS::Serverless::SimpleTable →
AWS::DynamoDB::Table - AWS::Serverless::StateMachine →
AWS::StepFunctions::StateMachine+AWS::IAM::Role - AWS::Serverless::LayerVersion →
AWS::Lambda::LayerVersion
Important Notes
- This tool is a preview approximation. The official AWS SAM Transformer used by
sam deployapplies 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:
- js-yaml (v4.1.0) - License: MIT (Vitaly Puzrin) - https://github.com/nodeca/js-yaml
References:
Tech Blog with curated related content
Web Tools Collection
Written by Hidekazu Konishi