Production-Ready CDK - Prelude

Production-Ready CDK - Prelude

News, news!

I am starting a new blog series on Cloud Development Kits, first with AWS Cloud Development Kit(CDK). Then later, planning to jump to CDK for Terraform (CDKtf) and combine it with CDK for Kubernetes(CDK8s). Let’s see how far this goes.

What is a Cloud Development Kit, and how to start using it?

I won’t discuss what CDKs are or why to use them compared to the other Infrastructure as Code tools. To learn more about CDKs and particularly AWS CDK, I recommend starting by watching this video from AWS re:Invent 2018, especially if you don’t have that much experience with Infrastructure as Code tools. Although some things changed from 2018, the first part of the video will be relevant for many years because it explains the main concepts.


After watching the video, I highly recommend getting hands-on and following CDK Workshop. Then it makes more sense to follow this series.

Finally, the CDK Book can help if you want to go deeper.

What is my experience with CDKs?

I work as a Cloud Architect/Consultant, and I have been using AWS CDK already more than two years. I used it mainly for serverless applications, CI/CD pipelines, and platform-level solutions at four different companies. However, I don’t use it 8 hours a day, and there are better people in this field who are actively developing the tools I will use. So I will learn more as I write, and meanwhile, I will share my humble opinions and knowledge in every detail to make your CDK learning journey easy and smooth. I hope you will enjoy it!

Who is the audience?

Mainly anyone who is a Cloud Enthusiast. But providing some titles: Cloud Engineers, Software Engineers using Cloud, Cloud Architects, and DevOps Engineers.

Why “production-ready”?

I am doing the “Production-ready” way because most of the resources and articles I find online focus on fundamental use cases. I often need to code my constructs very differently. The main reason is those examples are not for the production level or enterprise level.

In this series, I will share insights for production-grade CDK apps. So the focus is not explaining concepts shortly and quickly. Instead, we will do the opposite and try to get into the details that will make your applications secure, scalable, and available. Which doesn’t mean the code I will be sharing will be ready to use in your production environment. You still need to make it your own, but it will give you ideas on real cases. You will have your views after you read and try. Hey, this is great because CDKs are all about opinions and abstractions!

Which tools are we going to use?

  • AWS (duh!)
  • Typescript
  • Projen
  • Github
  • AWS CodePipeline
  • and others in the future

If you haven’t decided to use AWS CDK as your Infrastructure as Code tooling for AWS:

Well, for sure you need to compare and decide. But, if you are considering it for personal projects, I can promise you won’t regret it. It will be fun, and you will learn valuable skills for the present and the future.

Screenshot 2022-01-18 at 15.04.05.png

If you are considering it for your team: there are multiple factors you need to think like tools already in use, people’s expertise, existing enterprise tooling, etc.

But to give you some ideas, you can read the following:

If you are not sure which programming language you should use for AWS CDK:

We all have different tastes in programming languages, but I suggest using Typescript because of jsii. Jsii is the tool that enables some other programming languages to import and use Javascript classes. In other words, if we write our CDK constructs in Typescript, we can package them for other languages, and for example, when using Python, we can import those constructs! But beware, it doesn’t work the other way. If you write your constructs in Python, you cannot import them in Typescript. Also, most of the AWS CDK examples are for Typescript CDK Apps.

The second language I can recommend is Python. It suits CDK programming very well; you can compactly write your constructs.

Important tip: we shouldn’t pick our CDK language thinking of our frontend or backend programming experience. Coding CDK apps is very straightforward, we use Object Oriented Programming much less, and we never use design patterns(well, you can, but why should you). Considering these, Typescript and Python-like languages suit better compared to Java or C#.

Finally, I will be sharing the code on Github and keep updating and maintaining it. If you have any suggestions, requests, or ideas, please send me a message!


Our first topic is Project Structure for AWS CDK Apps using Projen. See you in the next ones, cheers!