Introduction

If your team is using CloudFormation as its Infrastructure as a Code solution but is challenged by its many shortcomings, there may be a better option. CloudFormation is powerful, but as our team scaled, it presented us with several issues.

Adding resources via CloudFormation templates can be a time-intensive and frustrating process. The documentation leaves a lot to be desired and the lack of reusability leads to a lot of repetitive configuration. We frequently struggled with merge conflicts that were made difficult to resolve by the confusing structure of CloudFormation resource definitions.

A common complaint from our team was that we would spend as much time configuring the resources as we would write the code for a new API endpoint. On top of that, there was not a solid solution when it came to testing our configuration. This led us to search for an alternative and we landed on Amazon’s Cloud Development Kit (CDK).

What is CDK?

Cloud Development Kit at its core is a tool that allows you to define infrastructure via your choice of several programming languages. TypeScript, JavaScript, Python, Java, and C# are all officially supported. At build time, a CloudFormation file is generated which can then be used to deploy your cloud resources. This has been extraordinarily beneficial for several teams at JBS as we strive to deliver quality code while maintaining a high velocity.

Testing

Right out of the gate, we benefitted from being able to define our resources in Typescript. We set up our automated testing suite to run our application and CDK stack tests via a single command. This allowed us to seamlessly transition from writing unit tests for our app code to write them also for our configuration. We also enabled our main application’s linter to cover our CDK configuration which keeps our coding style consistent and clean.

One Programming Language for App and Configuration

Before using CDK, adding cloud resources felt like a chore which was a separate effort from developing the functionality which would utilize those resources. Once we integrated CDK, that changed overnight. The process of adding resources and developing a feature now went hand in hand. The reduced context switching produced a clear uptick in velocity for our team.

Code Reuse

From a technical perspective, one of the greatest benefits of using CDK is the ability to reuse code. As a part of our migration effort, we stood up a standalone library with standardized definitions for our most frequently used resources. This meant that if you wanted to add an S3 bucket, all the boilerplate was gone and you simply had to instantiate a bucket with the desired name and encryption key. It allowed our team to focus on the functionality we needed to deliver instead of having to worry about how to properly define a CloudFormation resource.

Conclusion

The transition to CDK has been a tremendous success. Replacing tedious CloudFormation template development with streamlined code helped us to eliminate a major source of pain. It allowed us to deploy cloud resource changes more efficiently and do so while increasing quality via our testing suite.

The JBS Quick Launch Lab

FREE 1/2 Day Assessment

Quantify what it will take to implement your next big idea!

Our intensive 1/2 day session will deliver tangible timelines, costs, high-level requirements, and recommend architectures that will work best, and all for FREE. Let JBS show you why over 20 years of experience matters.

Get Your FREE Assessment