25/11/2016 Ben Bridts

Troposphere helper functions

Here at Cloudar we write a lot of CloudFormation to provision AWS resources. We really like the way CloudFormation creates resources in parallel and how it provides an easy way to clean up all created resources.

However writing CloudFormation can be a bit of a pain. Even though AWS made this a lot easier with YAML support, for  big templates we still use Troposphere. Troposphere is a python package that provides a simple (one-on-one) mapping to CloudFormation. It has some advantages like offline error checking, but its greatest assets is that it can be used in combination with a real programming language.

Having python available to write templates, leads to writing helper functions to simplify some verbose constructs and bundle commonly used resources. Today we’re happy to publish this as on open source package.

You can find our troposphere helpers on pypi or on github.

Here is an example of how it can simplify CloudFormation code:

This is the normal way to add Option Settings to an ElasticBeanstalk configuration in Troposphere:

Using our helper function this can be reduced to:

And this is only one of the different functions in there (and we expect to keep adding to this over time).

Do you have any helper functions you’ve written? Let us know!

Leave a Reply

Your email address will not be published. Required fields are marked *