My experience with AWS CDK

Fouad Roumieh
2 min readFeb 24, 2022

When I first heard about a tool that would use programming languages to provision infrastructure on the cloud, I was intrigued to see how it would work, especially for someone like me who doesn’t like yaml or json for such tasks (I see yaml for config and json for data), and also for someone who works with code on a daily basis.
I’ve been using and experimenting with the AWS CDK to provision infrastructure in production for the past two years. Here are some of my thoughts and opinions on it:

Easy to start with if you have coding background

As you may be aware, cdk makes use of genuine programming languages (TypeScript, JavaScript, Python, Java, C#/.NET, and (in developer preview) Go), thus if you come from a coding background, you’ll have an advantage to begin with and will speed up your learning process. Although it does not necessitate extensive coding skills, it is primarily concerned with constructs, which are the main building blocks in CDK , but it is still a code.

The Syntax is straight forward

I didn’t need to take programming pattern courses when I was constructing with cdk, probably the only reference I needed was the official cdk documentation to find out the names of the properties or how a given configuration is done.
Check out this cdk example for s3 bucket to get a sense of what I’m talking about:

const mys3Bucket = new s3.Bucket(this, “BucketStack”, {    bucketName: “example-s3-bucket”,    removalPolicy: cdk.RemovalPolicy.RETAIN,    encryption: s3.BucketEncryption.S3_MANAGED});Tags.of(mys3Bucket).add(“tagname”, “tagvalue”);

how easy is that?

For me, Cloudformation was a learning experience, whereas with CDK, setup and deployment took me only few minutes.

I’m able to use my favourite IDE to provision infra

Because it’s about creating code blocks to describe infra, I’m able to use my favorite IDE, which I’ve been using for years, Visual Studio Code, and all of the benefits of IntelliSense, error checks, finding properties quickly, and so on.

Continuous update from the aws cdk team

I noticed that the aws cdk gets weekly or monthly updates from the team behind it, indicating that it is continuing to evolve and grow; for more information, see the releases page on github. This provides you peace of mind that it is taken care of.

Finally, the trend of provisioning infrastructure using programming languages is expanding, and seeing Terraform follow suit indicates that it wasn’t a horrible idea to begin with, so if you haven’t already, I recommend giving it a shot.

--

--