Difficulty: Beginner
Estimated Time: 5 minutes

AWS CloudFormation tools

The AWS UK Solution Builders have developed a number of tools that improve the experience of developing and using CloudFormation. With this training you'll learn how to use some of those tools.

How does it work?

You'll need to follow the steps on the left panel. In any moment, you can click on the Terminal and play with the tools. That is an actual Ubuntu machine setup as a sandbox for you to play around.

Thanks for your time!

As promised, here is a little summary of what we learned today:

What would you want for improving your Developer Experience with AWS CloudFormation? Let us know via email: [email protected]

AWS CloudFormation Developer Tools

Step 1 of 3

cfn-flip

Converting JSON to YAML

For years, CloudFormation only supported JSON. We released YAML support and customers wanted a way to convert their existing templates.

AWS CloudFormation Template Flip is a tool that converts AWS CloudFormation templates between JSON and YAML formats, making use of the YAML format's short function syntax where possible.

The term "Flip" is inspired by the well-known Unix command-line tool flip which converts text files between Unix, Mac, and MS-DOS formats.

Step 1: Install

AWS CloudFormation Template Flip can be installed using snap: snap install cfn-flip

Mac user? You can install via PIP too!

Step 2: Try it

Now you can see the available commands by typing:

cfn-flip

Step 3: Flip it

To test the tool let's create a basic JSON template: echo '{"Description": "Test","Foo": { "Fn::Join": [" ", ["The", { "Ref": "cake" }, "is", "a", "lie"]] },"Bar": { "Fn::Base64": { "Ref": "Binary" } },"Baz": { "Fn::Sub": ["The cake is a...\n${CakeStatus}", { "CakeStatus": "lie" }] }}' >> example.json

Reading from stdin and outputting to stdout: cat example.json | cfn-flip

Reading from a file and outputting to stdout:

cfn-flip example.json

Reading from a file and outputting to another file:

cfn-flip example.json output.yaml

Reading from a file and cleaning up the output:

cfn-flip -c example.json

Conclusion

We'll remind you the repo link at the end of the tutorial: github.com/awslabs/aws-cfn-template-flip.

Now go to the next step to learn about another tool.