Data Management Blog: AWS CloudFormation: reluctantly embracing YAML

 

Data Management Blog
Data management, Cloud, Transformation and anything else...









AWS CloudFormation: reluctantly embracing YAML


Yet Another Markup Language?  Really?
That was my view of YAML for a very long time.  As someone who has no problem with various formats for structured information like xml, json, etc, I couldn't see any real use case for making another one.  And then came AWS CloudFormation.
AWS CloudFormation uses templates for provisioning assets in the cloud.  I'd been working on a problem and it involved creating a Lambda function.  This in tern means creating and managing an IAM Role and Policy.  It also played into some S3 for storage (trying to go full serverless).  And so the CF template was quickly getting sizable.  And since there is no CF schema to work with (although there are attempts at such), there is no authoring "helper" that can be derived from the governing schema.  Which is why one can author easily in Xml no matter how large because the schema can help you and authoring tools.
Having used JSON for a long time (and even JSON Schema too), I was working with that syntax in CF.  The tools support for JSON is good and make it easier to work with, especially features like code folding.  But when you scale JSON larger and larger, it starts to become unwieldy.  Don't get me wrong, I've dealt with JSON files many megabytes in size before.  So it isn't just a matter of size. With large JSON files that are consistent and repetitive, you can fold code/copy code and manage it not unlike Xml.
However with CF, I was getting frustrated at the process of brute force trial an error I was involved in.  (Ok, I know there are tons of template snips out there - and I was using them - but nothing did EXACTLY what I was trying to do.  So they were all "sorta" useful.)  I finally broke down and said, I'll try something new just to see if it has value.  And I dug into YAML for CF templates.  Structured, hierarchical, fold-able code is very familiar, so the literals of YAML were no problem.  But was it any better than JSON?
Enter Notepad++.  This tool brought the features needed to make YAML work just like JSON and Xml.  First and foremost code folding.  So I was more easily able to take code snippets and work them into my CF template.  Testing along the way.  And I began to like YAML.  Eminently more readable and more compact in terms of fitting code on a viewable page, it allowed me to visualize more of what I was authoring.  That has proven key to my progress.  And the explicit formatting of white space allows for easy viewing of indentation.  It was starting to look a lot like Python.
So I've come around to this new "Python-like" markup known as YAML.  It does have a use case that I can get behind.  Call me a reluctant embracer of YAML.

© Copyright Paul Kiel.