Infrastructure as code or IaC has recently become a huge topic in the software world.
No longer do we live in a monolithic application world that’s only made up of a couple of huge legacy components that changes only a couple of times a year. No, we now live in a world thats broken up into tiny independent micro services and serverless applications thats continuously changing.
What does that mean? Well it means if you don’t have IaC you will quickly become overwhelmed with so many thing including service version control, replication across multiple availability zones and environments, rollback .
IaC can often solve these issues for you. However with the growth in this space comes a growth of tools to help you and it can sometimes be hard to decide what tool it’s best for the job.
Traditionally in AWS developers would user cloud formation templates. CF would allow the developer to create a template describing all the infrastructure and the way it connects what they needed.
Cloud formation templates allow developers / dev ops to start creating version controlled descriptions of the stack that can then be deployed as part of cicd pipelines to any environments needed.
This may sound good and it was a big step forward for IaC but even what you would think to be simple infrastructure can take hundreds of lines of complex cloud formation templates.
That’s where the CDK comes in.
AWS CDK is true infrastructure as code. It allows developers to create projects in there favourite languages that can be used to generate the cloud formation templates needed with simple functions and libraries.
With just a few handful lines of code developers can now create entire api gateways, full serverless applications, large scale stacks that can be deployed repeatedly across any environment at the click of a button or hook of a commit.
CDK code can be put into unit tests for test driven development. Logic can be implemented as part of the build processes.
Package manager tools such as npm are now starting to flourish with libraries being built for common stack patterns.
As CDK grows and more people become aware it will become the number 1 AWS IaC tool.
If you are not looking at CDK as an AWS dev then start now. Try the AWS workshop on your account and see for yourself the benefits this will have when creating True infrastructure as code.