CDK is growing in popularity in the AWS ecosystem, and is set to be the successor of CloudFormation, being built natively for the configuration of AWS resources. Learn how this is a game changer for NodeJS programmers & stacks.
Level: intermediate
CDK is growing in popularity in the AWS ecosystem, and is set to be the successor of CloudFormation, being built natively for the configuration of AWS resources. Learn how this is a game changer for NodeJS programmers & stacks.
AWS CDK, or Cloud Development Kit, is a framework developed by AWS that allows developers to define their cloud infrastructure using familiar programming languages instead of configuration languages. It enables the creation of cloud resources using constructs which are higher-level components that pre-configure cloud resources with sensible defaults.
AWS CDK is considered a successor to CloudFormation, offering improvements such as the ability to use programming languages for defining infrastructure, which can simplify the creation and management of complex setups. CDK also supports multi-regional deployments more effectively than CloudFormation, which requires stack sets for similar functionality.
Yes, while AWS CDK is written in TypeScript and works best with it, it also supports other programming languages including JavaScript, Python, and Go, allowing developers to define infrastructure using the language they are most comfortable with.
Migrating from CloudFormation to AWS CDK can simplify infrastructure management by reducing the complexity and size of configuration files, improving readability and maintainability. CDK also allows for easier handling of multi-regional deployments and offers a more intuitive approach by using familiar programming constructs.
AWS CDK is suitable for developers, DevOps, and SRE teams who are already using AWS and prefer to use code for infrastructure management. It is especially beneficial for users looking to migrate from CloudFormation, as it simplifies and enhances the infrastructure as code practices.
AWS CDK simplifies multi-regional deployments by allowing developers to define multiple stacks within their code, which can then be deployed to different regions directly without the need for additional tools like AWS Stack Sets, which are required when using CloudFormation.
Migrating from CloudFormation to AWS CDK involves creating equivalent CDK constructs for existing CloudFormation templates and then deploying these constructs using CDK commands. The process is streamlined due to the similar underlying mechanisms between CloudFormation and CDK.
No, AWS CDK is specifically designed for managing AWS resources and does not natively support other cloud providers. For multi-cloud environments, tools like Terraform or Pulumi might be more appropriate.
Key advantages of using AWS CDK include the ability to use general-purpose programming languages, simplified multi-regional deployments, improved code reusability, and a more intuitive approach to infrastructure as code that leverages familiar coding practices.
AWS CDK is a concept that allows you to use coding languages to create infrastructure as code, making it more flexible and powerful than traditional config languages. CDK offers benefits such as improved developer experience, multi-regional deployments, and a programmatic approach to infrastructure as code. It is a suitable choice for AWS users, particularly those familiar with CloudFormation. CDK can be used to migrate from CloudFormation to a more efficient and user-friendly infrastructure management tool. CDK also provides drift detection and supports multi-region deployment, making it a popular choice for managing infrastructure on AWS.
I'm going to talk to you about AWS CDK and what does it mean for the world of infrastructure as code using AWS CDK. CDK aka Cloud Development Kit is a concept not only by Amazon also by Kubernetes and also by Terraform themselves. CDK means that you're not using any config language to create your infrastructure as code such as the JSONs, HCLs and even YAMLs but you're using coding languages in the AWS CDK, they now support TypeScript of course and JavaScript.
Hey everyone, I'm Roy and today I'm going to talk to you about AWS CDK and what does it mean for the world of infrastructure as code using AWS CDK. Today I'm an engineering team leader at Firefly and what we do at Firefly is to take your entire cloud footprint along with your Kubernetes clusters infrastructure and on the other end to take your infrastructures code if it's CDK or even Terraform, Pulumi, CloudFormation and even Helm and to combine them and to show you a merged inventory that shows your entire cloud asset footprint in the means of your infrastructure as code.
Also as you can see I like Schnitzel call of duty and infrastructure as code, I guess the same as all of you. What is actually CDK and what is the huge hype about CDK so when I was visiting the last AWS event I couldn't stop noticing that everyone is asking about CDK. They asked how to start working with CDK and in what languages they wanted to know how they migrate their own CloudFormation stacks into CDK and I think that with all these questions I started investigating as part of what we do at Firefly which is to use the best infrastructure as code and to supply our customers the best infrastructure as code and after a quick run over CDK I discovered an amazing new tool by AWS that you must be familiar with and an even easier way to migrate your CloudFormation into CDK so what is actually CDK?
CDK aka Cloud Development Kit is a concept not only by Amazon also by Kubernetes and also by Terraform themselves. CDK means that you're not using any config language to create your infrastructure as code such as the JSONs, HCLs and even YAMLs but you're using coding languages in the AWS CDK, they now support TypeScript of course and JavaScript. TypeScript by the way is the language that it was written in so it works best in TypeScript but also JavaScript Python and even Golang. Besides CDK is the CloudFormation successor. CDK is the brand-new fully-oriented AWS tool to create resources with and it's much better than CloudFormation.
CloudFormation is messy and not so likeable to work with, but CDK solves these issues by using classes and variables to create resources. CDK also supports multi-regional deployments, allowing you to create multiple stacks and deploy them to different regions. CDK is the native experience for AWS and supports multiple languages. It turns code into cloud formation stacks, which can be deployed using CDK deploy. CDK is suitable for anyone using AWS, especially CloudFormation users looking to migrate their stacks. It's also beneficial for DevOps, SRE teams, and developers who want a more programmatic approach to infrastructure as code.
In let's say three major points. The first one is that CloudFormation is messy. If you're gonna write lots of resources because of its super explicit way of approach even CloudFormation is going to be a super huge YAML or JSON. Depends on your benefit but it's gonna if you have much resources, it's going to be a heavy file and not so likeable to work with.
Also, if you're gonna create relations in your CloudFormation it's going to be a hell because it's making it super messy super buggy and not even understandable for anyone that doesn't know it. CDK solves all of these notes because CDK uses classes and variables such as any other coding language to create the resources with it.
Also another major point is the multi-regional way of working with CloudFormation. As you already know, CloudFormation does not support multi-regional and if you want to deploy your CloudFormation stack in some, in multiple regions, you'll need to use stack set, a kind of patch that AWS wrote to deploy one CloudFormation stack in multiple regions. With CDK it's basically solved because CDK supports the stack out of the code. You can create as much stacks as you can inside your code and just deploy them one by one into each region you wish.
Also, CDK is basically now the native experience of AWS, which means that it's not only 100% AWS-orient, it's the only way to, the only way, the only thing you can write with CDK is basically AWS, so it's not fit to any other providers, it's full AWS service so it means it works best with AWS and only AWS. Even more than this, as I already said, CDK supports multiple languages. The most typical one is TypeScript but you can write also JavaScript and much more languages with it, which is amazing because basically, if you think about it, you can write one repo, put in this repo your already existing coding or programming functions. On the other hand, you can put in the same repo your infrastructure as code, such as in CDK, and then if you, let's say, deploy an instance with some code, you can define the instance itself in the same repo, which is basically a branding amazing way to work with infrastructure as code.
So, how does CDK work? CDK turns code into cloud formation stacks, which basically means that AWS wrote CDK on top of the old cloud formation mechanism. You're going to write it in each language you wish, as we already described, and you're going to write constructs, which means creating an S3 bucket resource or a instance resource, for example. After writing this in these resources, you're going to use the command CDK synth, which is basically a dry run of what you already wrote, and it will generate automatically the cloud formation template that describes exactly the resources you wrote in any other coding language you used. So, creating the CDK synth created a template, and then following that, you're going to use CDK deploy to deploy the stacks by actually creating cloud formation stacks with this template inside, and creating out of the stacks the resources on your AWS specified region or regions, for example.
Deploying will create two artifacts, one, an S3 bucket files that run the state, let's say, of your CDK code. It saves the resources that were created, the changes that it made, and you can track over there and see the state of the lately deployed stack. Beside, it's going to create the CloudFormation stack itself, which creates the resources out of it. Into your cloud.
So who should use CDK and when? It's a pretty typical question because the who is basically everyone, everyone that uses AWS because CDK is the 100% oriental way to approach, let's say, to create infrastructure as code over Amazon. And especially CloudFormation users that wish to migrate the CloudFormation old stacks into CDK. It's gonna be a pretty easy process to go through and we'll do it in the example following that. Another group is like any DevOps or SRE teams that are working with AWS. And besides, if you can think about it, even your developers can use CDK because now it's not a knowledge you need to experience with YAMLs or config. It's just coding, the same as any other programmatic coding you do. And besides, all of the infrastructure code users who work over AWS, it's best to work with CDK.
When? When is, I think, every time because if you're already using any infrastructure as code, it's always a good way and always a good time to start working with a tool that is officially working with AWS.
We constantly think of articles and videos that might spark Git people interest / skill us up or help building a stellar career
Comments