A developer has deployed CDK stacks (including Lambda assets) to an alpha environment in Account A using cdk deploy. Deploying the same stacks for the first time in a second account (beta) fails with a NoSuchBucket error. Which CDK CLI command should be run in the beta account before redeploying to fix this issue?
Choose an answer
Tap an option to check your answer.
Correct answer: cdk bootstrap.
Why this is the answer
The cdk bootstrap command is essential for preparing an AWS account for CDK deployments. It provisions resources like an S3 bucket (for storing assets such as Lambda code and CloudFormation templates) and IAM roles that the CDK Toolkit needs to deploy stacks. The NoSuchBucket error indicates that this necessary S3 bucket does not exist in the beta account. Running cdk bootstrap will create these foundational resources, resolving the error. cdk synth synthesizes the CDK application into CloudFormation templates but does not deploy anything or provision foundational resources. cdk init initializes a new CDK project, which is not relevant for deploying an existing project to a new account. cdk destroy tears down deployed CDK stacks, which is the opposite of what's needed here.
Pass your exam — without the endless answer hunt
Get every verified question and explanation for this exam in one place, and save hours of prep. 1,000+ certifications · 20+ languages · free to start.
Pass your exam faster → No card needed