Get Started with AWS CDK


Module 2: Install the AWS Cloud Development Kit (CDK)

In this module, you will install and configure the AWS CDK


Before you start your work with the AWS CDK, you need to have its toolkit (CLI) ready and available on your workstation. This tool will be the link between the code you write and the infrastructure you provision, so it is important to have it set up and using the latest version. Additionally, once the CLI is configured, you will need to bootstrap your account so CDK can deploy resources to it properly. The bootstrapping process creates resources required for the CDK to operate correctly.

What You Will Learn

  • Installing the AWS CDK CLI (Toolkit)
  • Bootstrapping your AWS Account

 Time to Complete

5 minutes

 Module Prereqs

  • AWS Account with administrator-level access**
  • Recommended browser: The latest version of Chrome or Firefox

[**]Accounts created within the past 24 hours might not yet have access to the services required for this tutorial.


Installing the AWS CDK CLI

To install the AWS CDK CLI, you need to first have the Node Package Manager (npm) installed. Install the AWS CDK CLI globally by running the following command:

npm install -g aws-cdk

To verify that it has been successfully installed run the following command:

cdk --version

Bootstrapping your AWS Account

Many AWS CDK stacks that you will deploy, will include assets, external files that are deployed with the stack, such as AWS Lambda functions or Docker images. The CDK uploads these to an Amazon S3 bucket or other containers so they are available to AWS CloudFormation during deployment. Deployment requires that these containers already exist in the AWS account and the region you are deploying into. Creating these containers is called bootstrapping. To bootstrap your AWS account (and a given region), run the following:

# Get the account ID
aws sts get-caller-identity

# Bootstrap the account
cdk bootstrap aws://ACCOUNT-NUMBER/REGION

The bootstrap command should look something like this:

cdk bootstrap aws://123456789012/us-east-1

# Output
⏳  Bootstrapping environment aws://123456789012/us-east-1...
CDKToolkit: creating CloudFormation changeset...

✅  Environment aws://328159166015/us-west-2 bootstrapped.

If you wish to use different accounts and regions, make sure to bootstrap each of those. 


This should take care of everything you need to start working with AWS CDK. Once you have the CLI installed and the AWS Account and region combination bootstrapped, you can start writing and deploying some infrastructure.

Up Next: Create CDK Project

Let us know how we did.

Thank you for your feedback
We're glad this page helped you. Would you like to share additional details to help us continue to improve?
Thank you for your feedback
We're sorry this page didn't help you. Would you like to share additional details to help us continue to improve?