What is AWS CDK?
Hola Amigos,
In this article I am going to talk about following topics -
1. Why to use CDK?
2. What is CDK?
3. How it works?
4. Advantages of CDK over alternative IAC solutions.
Why to use CDK?
When starting with AWS we normally start from AWS console. Navigate through the UI and create resources. For small projects it is easy to creating things manually from the console but it becomes difficult when it comes to scale.
To create a complex architecture and manage everything manually from console becomes difficult in a large team working together. Someone can accidentally delete or change something which is not required. This is where CDK comes in.
What is CDK?
CDK (Cloud Development Kit) is basically an IAC (Infrastructure as code) solution provided and managed by AWS.
Using IAC we manage our infrastructure same way we manage our application code.
CDK supported in different languages Java, TypeScript, JavaScript, C#/.Net, Python and GO.
So we can choose language of our choice and get all the support for writing IAC that we get for application code like code autocomplete, versioning with git. Our IAC can also be reviewed before being pushed by our peers for better code quality and double check.
Writing IAC also give us power that comes with the programming language like conditional statements, for loops etc. to create complex conditional architecture. For example something we what to be created in dev but not in prod, we can mention it in our code and use same code to reprovision different infrastructure in different environment.
How it works?
There exists another thing called Cloud Formation. It is also IAC solution developed by AWS. Cloud Formation has its own template files that needs to be created to provision AWS resources.
So behind the scene CDK first gets compiled to Cloud Formation and then AWS uses this template to provision the resources.
To use CDK learning Cloud Formation is not at all required but it can be helpful sometimes when debugging.
Advantages of CDK over alternative IAC solutions
There are other similar options also available as alternative to CDK Terraform, Pulumi etc.
The main advantage of using CDK over them can be that CDK is managed by AWS so it has long term support benefit and we can expect all the latest changes in CDK that comes in AWS.
Conclusion
CDK is basically an IAC solution provided by AWS which helps in manage our infrastructure better and make deployment experience on AWS easier.
Subscribe to my newsletter
Read articles from Adarsh Kumar Verma directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
Adarsh Kumar Verma
Adarsh Kumar Verma
Software Engineer with 3+ years of experience (as of July'24), here to blog my learnings and learn from others.