AWS Certified Developer – Associate (DVA-C02) — Question 553
A developer is setting up the deployment of application stacks to new test environments by using the AWS Cloud Development Kit (AWS CDK). The application contains the code for several AWS Lambda functions that will be deployed as assets. Each Lambda function is defined by using the AWS CDK Lambda construct library.
The developer has already successfully deployed the application stacks to the alpha environment in the first account by using the AWS CDK CLI's cdk deploy command. The developer is preparing to deploy to the beta environment in a second account for the first time. The developer makes no significant changes to the CDK code between deployments, but the initial deployment in the second account is unsuccessful and returns a NoSuchBucket error.
Which command should the developer run before redeployment to resolve this error?
Answer options
- A. cdk synth
- B. cdk bootstrap
- C. cdk init
- D. cdk destroy
Correct answer: B
Explanation
The NoSuchBucket error occurs because the target AWS account and region for the beta environment have not been bootstrapped to receive CDK deployments that include assets. Running the cdk bootstrap command provisions the necessary Amazon S3 bucket and other resources required by the AWS CDK to store and manage deployment assets. Other commands like cdk synth, cdk init, and cdk destroy do not provision these required bootstrap resources.