My CloudFormation IDE

Writing CloudFormation or SAM templates by hand is very powerful, but can also be quite frustrating without a good IDE setup…

Update 2/19/2021

Check out Serverless IDE for VS Code it has CFT Linting and Type Checking!!!

VSCode CloudFormation Language Support

I develop my CloudFormation templates in Visual Studio Code with the help of the redhat.vscode-yaml extension.

You MUST add these custom tags to your VSCode settings.json file to get the best experience.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
{
"yaml.customTags": [
"!And sequence",
"!If sequence",
"!Not sequence",
"!Equals sequence",
"!Or sequence",
"!FindInMap sequence",
"!Base64",
"!Cidr",
"!Cidr sequence",
"!Ref",
"!Sub",
"!GetAtt",
"!GetAtt sequence",
"!GetAZs",
"!ImportValue",
"!Select",
"!Select sequence",
"!Split sequence",
"!Join sequence",
"!Condition"
],
"yaml.format.enable": true
}

Prettier

Also, check out Prettier to help format your code.

With YAML, whitespace MATTERS! Consistently formatted code in general helps you read/scan code quicker and makes code merges much easier.

SAM Validate

Don’t forget to add sam validate or aws cloudformation validate-template to your build step. I find that it only catches a few bugs, but it runs so quickly that it’s worth including.

TL;DR;

Use VS Code with the YAML extension with custom tags. Add Prettier as a bonus.

Share