Module 2: Install the AWS Cloud Development Kit


Install the AWS Cloud Development Kit

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

What you will accomplish

In this module, you will:
  • Install the AWS CDK CLI (Toolkit)
  • Bootstrap your AWS account


Before you start your work with the AWS CDK, you need to have its toolkit (CLI) ready and available on your workstation. This tool is the link between the code you write and the infrastructure you provision, so it is important to have it set up and to use the latest version. 

Additionally, once the CLI is configured, you need to bootstrap your account so the CDK can deploy resources to it properly. The bootstrapping process creates resources required for the CDK to operate correctly.

 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.

Install the AWS CDK CLI

To install the AWS CDK CLI, you need to first have the Node Package Manager (npm) installed. For more information, see Downloading and installing Node.js and npm.

Once you have npm, you can install the AWS CDK CLI by running the following command:

npm install -g aws-cdk

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

cdk --version

Bootstrap your AWS account

Bootstrapping is the process of creating containers in the AWS account and region you are deploying to. Many of the AWS CDK stacks you deploy include assets and external files, such as AWS Lambda functions or Docker images. The CDK uploads these assets and files to the containers created during bootstrapping, so they can be available to AWS CloudFormation during deployment.

To bootstrap your account you need your AWS account number and your region. 

To get your AWS account number, use the following AWS CLI command:

aws sts get-caller-identity

To display the default region for your account, use:

aws configure get region

Now you can bootstrap the account with the following command:

cdk bootstrap aws://ACCOUNT-NUMBER/REGION

The output of your bootstrap command should look something like this:

 ⏳  Bootstrapping environment aws://ACCOUNT-NUMBER/us-east-1...
 ✅  Environment aws://ACCOUNT-NUMBER/us-east-1 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.

Was this page helpful?

Create First CDK Project