The docs on AWS CDK boostrapping state of the cdk bootstrap
command:
cdk bootstrap
Deploys a CDKToolkit CloudFormation stack into the specified environment(s), that provides an S3 bucket that cdk deploy will use to store synthesized templates and the related assets, before triggering a CloudFormation stack update. The name of the deployed stack can be configured using the --toolkit-stack-name argument.
$ # Deploys to all environments
$ cdk bootstrap --app='node bin/main.js'
$ # Deploys only to environments foo and bar
$ cdk bootstrap --app='node bin/main.js' foo bar
However, how often does CDK need to be bootstrapped? Is it:
cdk bootstrap is a tool in the AWS CDK command-line interface responsible for populating a given environment (that is, a combination of AWS account and region) with resources required by the CDK to perform deployments into that environment.
Bootstrapping is the deployment of a AWS CloudFormation template to a specific AWS environment (account and region). The bootstrapping template accepts parameters that customize some aspects of the bootstrapped resources (see Customizing bootstrapping).
CDK allows you to use your existing skills and tools, applying them to the task of building cloud infrastructure. It also provides high-level components that preconfigure cloud resources with proven defaults, helping you build on AWS without needing to be an expert.
Using CDK bootstrap #We only need to use the bootstrap command once for every environment(region and account). If we use the command more than once, the CDK CLI will check if our CDKToolkit stack has to be updated. If necessary, the stack will be updated. If not, running the bootstrap command does nothing.
background:
cdk bootstrap is a tool in the AWS CDK command-line interface responsible for populating a given environment (that is, a combination of AWS account and region) with resources required by the CDK to perform deployments into that environment.
When you run cdk bootstrap
cdk deploys the CDK toolkit stack into an AWS environment.
The bootstrap command creates a CloudFormation stack in the environment passed on the command line. Currently, the only resource in that stack is An S3 bucket that holds the file assets and the resulting CloudFormation template to deploy.
cdk bootstrap command is running one time per account/ region.
Simple scenario to sum-up:
cdk bootstrap
- create a new s3 bucket, IAM roles, etc.cdk deploy
- to deploy your stack for the first time, new template added to bootstrap s3 bucket.cdk diff
- to view differences -Behind the scenes, CDK generates the new template and compare it with the CDK template that exists in the bootstrap bucket.
More about cdk bootstrap.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With