Eat like a bird, and poop like an elephant --Japanese philosopher

Validating EC2, RDS, Elasticache (Memcached and Redis) CloudFormation Parameters With Allowed Values

For anybody who is curious, my favorite Amazon Web Service is AWS CloudFormation. It allows me to to manage infrastructure as code. For a “DevOps” engineer, this is awesome! I use CloudFormation wherever and whenever possible and combine it with Ansible for a great one-two punch - Ansible to create images and CloudFormation to deploy and manage them.

One area where my CloudFormation templates need updating is the allowed values for EC2 Instance Types. Like a good engineer, I prefer to validate my inputs before submitting the stack to AWS. However, AWS will release new EC2 instance types leaving my templates out of date. Recently I went to change an instance type to c3.medium and failed my own validation. Even while I immediately knew the issue, I did not want a quick fix of only adding c3.medium to the list; I wanted to include all the new instance types.

I have not been able to find a programmatically available resource (like an API) that provides a current list of EC2 instance types. As a result, I am in the process of creating one. While I’m still fine-tuning the code for possible public release, the output is available for your immediate use:

If you notice the leading whitespace in the document, this is due to an upcoming series of blog posts on using CloudFormation. In that series, I will piece together CloudFormation templates using these snippets of json. The whitespace is there to make the json more readable in the final template.

Interested in the upcoming series? Follow me on twiter or sign up to the email list to learn when it comes out.