Last weekend I spent some time working on a small project: bora.1 It’s a simple wrapper around AWS Cloudformation, so obviously everyone’s question is: why the hell would I want yet another Cloudformation wrapper? tl;dr answer is: because all the ones which are available suck. But let me elaborate.
- Troposphere-based tools are inelegant. Troposphere itself is poorly documented, and I dislike how the Python code mixes with actual Cloudformation JSON code in it. It’s also very often non-lintable (or gets unreadable after linting).
I ❤️ Python just like the next guy, but it’s not very well suited for things like CI/CD pipelines. I see this a lot in clients’ setups: first your jenkins job needs to pull the code, then create a
pipthe requirements, then lint (hah!), and then, hopefully, run. With compiled languages (and Golang especially), you only need to download a binary and run it. The only thing you have to care about is the underlying architecture and OS (which, in 99% of the CI/CD cases, is
I want to embrace Cloudformation’s new neat & clean YAML capabilities. JSON is ugly. Troposphere, as mentioned already, is ugly too. Combining YAML with some Jinja-like markup for variables and loops, we could end up with something very elegant and readable.
With these requirements in mind, I began hacking, and I’m happy to say that bora, even though it’s in its earliest stages of development, fulfills all of them already.
Bora is written in Golang, which makes it fast, cross-platform, and portable. While you do need to setup a build environment for Golang if you want your jenkins job to build the tool (not sure why, but whatever), you only need to build it once per version. Other than that, all you need to do is put it some place your CI/CD can
curl from, et voilà, you’re ready to run the binary. For pipelines that involve many Cloudformation runs, this saves a significant amount of time, and reduces run-time dependencies to a bare minimum.
Furthermore, bora takes YAML templates as input, but also accepts YAML meta-templates augmented with Golang’s
text/template markup, which allows for setting variables and looping. It’s especially convenient when you need to deploy, say, multiple EC2 instances that differ in some details.
At this point bora is able to generate YAMLs, deploy, update and terminate stacks, and handle errors gracefully (you’d be surprised how few Cloudformation wrappers do this). Assuming roles for multi-account deployment is coming soon, along with other neat features. Stay tuned!