Blog
Wild & Free Tools

Convert AWS CloudFormation JSON to YAML — Free Online, No CLI

Last updated: April 2026 7 min read
Quick Answer

Table of Contents

  1. The 30-second conversion
  2. Post-conversion — shorten intrinsic functions
  3. Why YAML beats JSON for CloudFormation
  4. IAM policy JSON to YAML
  5. Former2, SDK generators, and legacy templates
  6. Frequently Asked Questions

AWS CloudFormation accepts JSON or YAML, but YAML has real advantages — shorter templates, inline comments, and the !Ref / !Sub intrinsic shortcuts. If you have a JSON template generated from an SDK, exported from Former2, or hand-written years ago, a browser converter flips it to YAML in one paste. Here's the workflow with notes on intrinsic functions and post-conversion cleanup.

The 30-Second Conversion

  1. Open your CloudFormation JSON template.
  2. Copy the full content, paste into the converter.
  3. Click Convert.
  4. Copy the YAML, save as template.yaml.
  5. Validate with aws cloudformation validate-template --template-body file://template.yaml or skip the AWS CLI and use cfn-lint.

That's the base flow. You get working YAML immediately. The next section covers the one follow-up step that's worth doing.

Post-Conversion — Shorten Intrinsic Functions

CloudFormation JSON uses long forms for intrinsic functions:

{"Fn::Ref": "MyBucket"}
{"Fn::Sub": "arn:aws:s3:::${BucketName}"}
{"Fn::GetAtt": ["MyRole", "Arn"]}

The converter produces equivalent YAML in the same long form — still valid, but verbose. Find-and-replace to the short form:

!Ref MyBucket
!Sub "arn:aws:s3:::${BucketName}"
!GetAtt MyRole.Arn

The short form is idiomatic YAML-CloudFormation and saves another 10-20% of lines. cfn-flip --clean does this automatically if you have the AWS SAM CLI. For a one-off, a text editor with find-and-replace is enough.

Sell Custom Apparel — We Handle Printing & Free Shipping

Why YAML Beats JSON for CloudFormation

Some teams keep JSON for programmatic generation and YAML for review — both work.

IAM Policy JSON to YAML

IAM policies are always JSON in the AWS console, but you can embed them as YAML inside a CloudFormation template using PolicyDocument. Conversion workflow:

  1. Copy the IAM policy JSON.
  2. Paste into our converter.
  3. Copy the YAML output.
  4. Embed under PolicyDocument: in your CloudFormation resource.

Note: PolicyDocument itself must be valid IAM policy syntax — the YAML equivalent of the JSON shape. Our converter preserves the structure, so after conversion you can paste it directly.

Former2, SDK Generators, and Legacy Templates

Common sources of CloudFormation JSON:

All three convert cleanly. The only manual step post-conversion is swapping long-form intrinsics to short form, which is optional but makes the template feel native.

Shorter, Cleaner CloudFormation Templates

Paste JSON, click Convert. Save 25-40% of lines and unlock inline comments.

Open Free JSON to YAML Converter

Frequently Asked Questions

Does converting change the CloudFormation behavior?

No — JSON and YAML templates are equivalent to CloudFormation. The stack deploys identically. Conversion is purely cosmetic.

Can I convert a CloudFormation template with Fn::Sub or Fn::If to YAML?

Yes — the converter preserves the long-form intrinsic functions. After conversion, optionally rewrite them as short forms (!Sub, !If) with find-and-replace. Both forms are valid.

Does AWS CloudFormation prefer JSON or YAML?

Neither — both are fully supported. Your team preference should decide. Most teams in 2026 use YAML because of comments, shorter templates, and better diffs. AWS's own documentation examples are mostly YAML now.

What about SAM templates (AWS::Serverless)?

Same conversion process. SAM is a transform layer over CloudFormation and works with either format. If you're using sam deploy, both JSON and YAML are accepted.

Andrew Walsh
Andrew Walsh Developer Tools & API Writer

Andrew worked as a developer advocate at two SaaS startups writing API documentation used by thousands of engineers.

More articles by Andrew →
Launch Your Own Clothing Brand — No Inventory, No Risk