Troubleshooting common problems with CDK
As you embark on your journey of coding CDK applications, you may encounter certain challenges that are common among CDK beginners. In this section, we will address some of these challenges and provide effective remedies to overcome them.
A common issue when using CDK is deploying to a new environment, which may result in an error stating that the environment has not been bootstrapped. Bootstrapping refers to deploying a pre-created AWS stack to a specific Region. This is necessary to set up the required resources for deploying any stack, S3 buckets, ECR repositories, and so on. As you may recall, we had to deal with this at the beginning of this book.
To resolve this issue, you can use the following command:
$ cdk bootstrap
You will have to do this everytime to you deploy a CDK project in new AWS accounts.