Production-Ready CDK – Prelude

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

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

I won’t discuss what Cloud Development Kits 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 watching this video from AWS re:Invent 2018, especially if you don’t have much experience with Infrastructure as Code tools. Although some things changed since 2018, the first part of the video will be relevant for many years because it explains the main concept behind CDKs.

After watching the video, I highly recommend getting hands-on and following the CDK Workshop. Afterwards reading this blog series will make a lot more sense. Finally, the CDK Book can help if you want to dive in a bit deeper.

What is my experience with CDKs?

I work as a Cloud Architect/Consultant, and I have been using AWS CDK for 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 people in this field who more actively develop the tools I use. So I will keep learning as I write, and meanwhile, I will share my knowledge in every detail to make your CDK journey as easy and smooth as possible. 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 CDK”?

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 that those examples are not fit for the production level or enterprise level I work on.

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 for real life cases.

Which tools are we going to use?

• AWS
• AWS CDK v2
• Typescript
• Projen
• Github
• CDK Pipelines
• 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 both the present and the future.

AWS CDK Architecture Diagram
AWS CDK is a higher-level IaC tool compared to CloudFormation or Terraform

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

But to give you some ideas, you can read the following:
Cloudformation terraform or cloud development kit guide to iac on AWS
Terraform vs cdk vs cloudformation
Adopting aws cdk

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 a tool that enables some other programming languages to import and use Javascript classes. In other words, if we write our 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 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 programming 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.

Projen – #TemplatesAreEvil

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

Meer weten over wat wij doen?

We denken graag met je mee. Stuur ons een bericht.