In a previous post, I talked about how CloudFormation now supports YAML for templates. The fine folks at AWS Labs have since released a Python package, cfn-flip, that you can install and use from a shell to convert a CF template from one format to the other: if you feed it JSON, it converts to YAML, and vice-versa. It also works when used as a Python library.
Installing and using cfn-flip is this easy:
[rcrelia@seamus ~]$ pip install cfn-flip Collecting cfn-flip Downloading cfn_flip-0.2.1.tar.gz Requirement already satisfied: PyYAML in /usr/local/lib/python2.7/site-packages (from cfn-flip) Requirement already satisfied: six in /usr/local/lib/python2.7/site-packages (from cfn-flip) Building wheels for collected packages: cfn-flip Running setup.py bdist_wheel for cfn-flip ... done Stored in directory: /Users/rcrelia/Library/Caches/pip/wheels/1b/dd/d0/184e11860f8712a4a574980e129bd7cce2e6720b1c4386d633 Successfully built cfn-flip Installing collected packages: cfn-flip Successfully installed cfn-flip-0.2.1 [rcrelia@seamus ~]$ cat /tmp/foo.json | cfn-flip > /tmp/foo.yaml