AWS CloudFormation is a very useful deployment mechanism provided by AWS and fully supported by ElasticBox. We’ve recently made some changes to our product and one of the results is a very interesting AWS CloudFormation use case – splitting up gigantic and monolithic AWS CloudFormation templates into smaller, more manageable templates.
First, A Little Background
AWS CloudFormation is essentially a way to programmatically define and provision cloud infrastructure, via a JSON template. CloudFormation templates can be used for tasks such as setting up VPCs, creating autoscaling groups and launching EC2 instances into different network configurations.
Several enterprises are using CloudFormation templates to deploy increasingly complex infrastructure configurations. As a result, power users are rapidly discovering that their templates have become large, monolithic and extremely difficult to maintain.
Why Not Just Split Them Up?
In theory, splitting up a monolithic CloudFormation template into a set of smaller, manageable modules seems straightforward, but there are a few challenges.
- Since these modules contribute to a larger, overarching infrastructure deployment, users need a way to specify dependencies and ensure that the modules are deployed in the right order.
- These modules need a way to communicate with each other and share information such that one can take over where the other one left off.
For example, if we built one CloudFormation template that did nothing but create VPCs, and another CloudFormation template that was responsible for deploying EC2 instances into VPCs, we need a way to pass the output of the first template (the VPC ID that was first created) as an input parameter of the second template.
And what if the output is not in the same format as the input for the second template?
How We Are Addressing This Pain Point
The first step was to enable users to deploy one template after another in a specific order. This is done through bindings.
The second step was to allow Boxes to exchange information. This is done through a text-type variable. It supports data transformation on the output of one Box before it is supplied as an input to another Box.
All these new features now enable users to break down monolithic AWS CloudFormation Templates into a set of smaller, more manageable and highly reusable modules. Greater reusability means faster innovation, fewer mistakes, and significantly lower maintenance costs.
To experience how this scenario works, please check out the examples and explanation in the documentation section.