AWS CDK: AWS’s take on infrastructure as code
By: Dhruv Sharma
Tags: Cdk, Cloudformation, AWS, Infrastructure, Cloud Services

Revolutionising the infrastructure generation thing for computer industry since 2006 and helping many large and small firms , AWS has given many cloud services like S3, DynamoDb, Elasticsearch etc, which are helping the industry scale easily.

One such tool which came in 2011 was AWS CloudFormation. It helps in modelling infrastructure in a template(YAML/JSON), also has a interactive UI for creating infrastructure.

AWS Cloudformation sample UI, where one can directly stitch the infrastructure components

July 2019: AWS launches CDK.

CDK(cloud development kit) is a simple framework for keeping infrastructure in code, it helps you provision and maintain infrastructure using AWS cloudformation.

Infrastructure in code in layman terms is maintaining(creation,updation or deletion) of infrastructure(tables/clusters/queues) using code.

Currently it supports typeScript, javascript, python, java, and C#.

Typescript is the recommended to use, as CDK is getting developed in typescript itself.

Problems with manual infrastructure

It’s 21st century and gone are the days when you have to manually rack and stack the servers and add endless configurations.

This involved too much configuration, expertise requirements, dependency on third party hardware firms and engineers, of course process was time taking .

Not to forget scaling up and down were nasty experiences.

Definitely cloud services like AWS/GCD(google cloud platform) have tackled these problems efficiently. But infrastructure in code is in its own league.

Why CDK

AWS has all sort of services and functionalities to help you build your simple or sophisticated applications. Be it Relational databases, Elasticsearch clusters, Graph Databases or any messaging queues.

Using CDK, one can provision and maintain all the required infrastructure which AWS provides, from a simple college project to industry production scale, it suffices for all.

It takes away all the manual effort required for configuration, permissions, scaling up/down etc.

If you have same infra in 30 places, which is there in many cases e.g. regional infras or development env infras or your infra may be divided in multiple AWS accounts.

Your effort for a simple config or permission change reduces to a config change and not 6 hours of manual work.

Which is really smart.

Which is really smart. You have a very clear picture of your infrastructure in a single place and very clear audit log as well.

This may not seem like a major advantage but when you operate at a scale where you have tens of tables, clusters, queues etc, it is really helpful.

You can replicate exact production infra in a staging environment to enable continuous testing, stress testing etc.

Everything is good with a story around

Lets say your infra comprises of 4 Neptune Dbs, 2 Elasticsearch clusters, some S3 buckets, couple of dynamoDb instances etc. This entire infra is replicated across multiple regions and development stages.

You have below tasks in hand:

Scale up/down the clusters or databases for a peak event.

Modify the permissions to add a client.

Doing it manually is quite painful even if you have AWS UI and error prone. With CDK it is pretty simple and just a config change and chances of mistakes are drastically reduced.

How CDK works

AWS has a very detailed explanation, which is sufficient for any interested party to get going with CDK.

https://aws.amazon.com/blogs/aws/aws-cloud-development-kit-cdk-typescript-and-python-are-now-generally-available/

Pages you might be interested in