Loading CloudFormation to Pulumi Converter...

How to Convert CloudFormation to Pulumi - Step by Step Guide

Step 1

Paste Your CloudFormation Template

Copy your CloudFormation template, JSON or YAML, into the left editor, or open a .json, .yaml, .yml or .template file with the Upload button. Parameters, resources, outputs and the common intrinsic functions (Ref, Fn::GetAtt, Fn::Sub, Fn::Join and a few more) are converted; the YAML short tags like !Ref work too.

•
Paste directly: Copy your CloudFormation template and paste it into the input editor
•
Upload a file: Click "Upload" to select a .json, .yaml, .yml or .template file from your computer
•
Try the sample: Click "Sample" to load a small S3 bucket template
Step 2

Review the Pulumi TypeScript Output

The right panel displays the converted Pulumi TypeScript code automatically. The converter maps CloudFormation resource types to their Pulumi equivalents and converts intrinsic functions to TypeScript syntax.

•
Resource mapping: AWS::S3::Bucket becomes aws.s3.Bucket automatically
•
Function conversion: Ref and Fn::GetAtt convert to TypeScript property access
•
Notes at the top: Anything the converter skipped, such as Fn::If or an unmapped resource type, is listed in a comment
Step 3

Download or Copy the Pulumi Code

Take the converted program into your project. It starts with the two imports it needs, and it is a first draft: check the property names against the @pulumi/aws types before you deploy.

•
Copy to clipboard: One-click copying for quick pasting into your project
•
Download as file: Save as a .ts file ready for your Pulumi project
•
Status: A green check means the template was read and converted; an error under the input says what is wrong and where
Step 4

Deploy with Pulumi CLI

Initialize a new Pulumi AWS project and deploy your infrastructure using the converted code.

•
Initialize project: Run pulumi new aws-typescript
•
Install dependencies: Run npm install to get required packages
•
Deploy infrastructure: Run pulumi up to preview and deploy

Frequently Asked Questions

What does the converter turn into Pulumi code?

Parameters become pulumi.Config reads (config.get, config.getNumber, config.getObject, or getSecret when NoEcho is set) with the template default after ??, and a parameter without a default becomes a config.require call. Each resource of a known type becomes a new aws.* resource named after its logical ID, DependsOn becomes the dependsOn option, DeletionPolicy: Retain becomes retainOnDelete, and every output becomes an exported constant.

Can I paste a YAML template with !Ref and !Sub?

Yes. JSON and YAML both work, and the YAML short tags (!Ref, !Sub, !GetAtt, !Join, !Select, !Split, !Base64, !GetAZs and the rest) are read the same as their Fn:: forms. You can also upload a .json, .yaml, .yml or .template file.

Which resource types and functions are supported?

About two dozen common types are mapped, including S3 buckets and bucket policies, EC2 instances, VPCs, subnets, security groups and route tables, RDS instances, Lambda functions, IAM roles, users and policies, DynamoDB tables, SNS topics, SQS queues, CloudWatch alarms, load balancers, API Gateway REST APIs and ECS clusters, services and task definitions. Ref, Fn::GetAtt, Fn::Sub, Fn::Join, Fn::Select, Fn::Split, Fn::Base64, Fn::GetAZs and the AWS:: pseudo parameters are translated. Anything else, such as Fn::If, Fn::FindInMap, Conditions or Mappings, is listed in the Notes comment at the top and left as undefined, so nothing is dropped without a trace.

Are the property names already the ones @pulumi/aws expects?

Not always. Property names are camelCased from the template, so BucketName becomes bucketName, and Tags lists become the { key: value } map Pulumi uses. The Pulumi AWS provider renames some properties and nests others differently, so run tsc or let your editor check the program against the @pulumi/aws types, and fix what it flags. IAM policy documents keep their original keys (Version, Statement, Effect) because AWS reads them as they are.

Will numbers and quoted values stay the same?

Yes. Numbers are written with the digits you typed, so 14.50 stays 14.50 and a long ID like 8901240544102066246 is not rounded in the code. A quoted value such as "00501" stays a string, and quotes, backslashes and line breaks are escaped so every string is valid TypeScript. Keep in mind that a JavaScript number can only hold about 15 digits exactly, so pass a value that long as a string when the property accepts one.

How do I run the converted code?

Create a project with pulumi new aws-typescript, replace index.ts with the downloaded file, set any parameters with pulumi config set, and run pulumi preview before pulumi up. If the stack already exists in CloudFormation, import the resources (pulumi import) instead of creating new ones, or Pulumi will try to create duplicates.

Is my template uploaded anywhere?

No. The template is read and converted in your browser, nothing is sent to a server and nothing is kept, so a reload starts with an empty editor.

Going the other way or to another tool? Try the Terraform to Pulumi or CloudFormation to Terraform converter, or read more in the Pulumi docs.