The Knowledge Seeker

What is AWS CDK?

AWS Cloud Development Kit (CDK) is an infrastructure as code (IaC) tool that allows users to define resource stacks using popular programming languages and then deploy those stacks using AWS CloudFormation. CDK is a command line interface (cli) tool that can be downloaded to a user’s development machine or CI/CD systems. The cdk cli tool provides functionality to create new projects, check differences between the deployed stack and the local configuration, synthesize the cdk code into CloudFormation script, and deploy directly from the machine running the tool. CDK is a purpose-built tool built on top of AWS cloudformation to provide enhanced functionality than native CloudFormation. Using fully featured programming languages allows users to create complex logic and conditions that can sometimes be required when creating resource stacks. At runtime, CDK can look up and resolve dynamic values that should not or could not be statically defined.

Basic Concepts

Commands

There are many commands available using the cdk cli tool. To use the cdk tool you must first install it on your machine. Additionally, you will need an AWS account, the aws cli and a profile already set up on the local machine. For information about the aws cli please see the aws cli documentation https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-welcome.html. For information about how to install the cdk cli tool and additional information about the following commands, see the cdk documentation https://docs.aws.amazon.com/cdk/v2/guide/bootstrapping.html.

CDK is a powerful tool with a lot more features than have been covered in this post. I highly recommend you read through the docs and work through some examples to get hands-on with CDK. The CDK workshop provides some great examples to get you hands-on with CDK (https://cdkworkshop.com/).

CDK is a great option for DevOps engineers who would need more functionality out of their IaC tooling and developers who would feel more comfortable keeping their IaC stacks closer to their code. IaC is extremely important for running applications in the cloud, and AWS CDK is a great option to have in your tech stack.