‫Okay, so what are the important commands
‫to know for the CDK?
‫So you have all of these and I will walk you through them
‫and this should make sense to you right away.
‫So the first one is to install the CDK CLI and libraries
‫so you can start writing your CDK stack.
‫The second one, cdk init initializes an app
‫from a specified template.
‫And so you can choose Python, JavaScript and so on.
‫Cdk synth synthesizes
‫and prints the CloudFormation template.
‫So this is the transformation between your CDK stack as code
‫into a CloudFormation templates.
‫Cdk bootstrap is something we'll see in the next slide,
‫so I will just skip it for now.
‫Cdk deploy is to deploy the stack.
‫So once you have a CloudFormation template,
‫of course, you want to deploy it.
‫Cdk diff is to look at the difference of the local CDK.
‫So whatever you have changed
‫and what is actually deployed on CloudFormation.
‫And cdk destroy is to destroy the stacks.
‫So the last little thing that we haven't discussed
‫in depth is cdk bootstrap.
‫So what is bootstrapping in CDK?
‫Well, bootstrapping is the process
‫of provisioning resources for CDK
‫before you can deploy CDK apps into an AWS environment.
‫So what is an environment in AWS?
‫Well, for CDK,
‫it's the combination of an account and a region.
‫So the idea is that before you are able
‫to deploy to an account and a region,
‫you must deploy a CloudFormation stack called the CDKToolkit
‫that will contain an S3 bucket
‫and it will contain an IAM role.
‫And these are necessary prerequisites
‫to deploying any CDK stack in that specified environment.
‫So when you are deploying
‫to a new account and region combination,
‫so a new environment, you do cdk bootstrap
‫and then aws://aws_account/aws_region.
‫So here is what happens.
‫We have the account and the region,
‫and the user runs the bootstrap.
‫A CloudFormation stack called CDKToolkit
‫is going to be created with what we need.
‫Now, if you try to deploy a CDK stack after this,
‫everything is going to work
‫but if you didn't bootstrap into your environment,
‫you will have an error when trying to deploy your CDK stack,
‫which will say policy contains a statement
‫with one or more invalid principle.
‫That's because you're missing the IAM role.
‫So that should make sense.
‫Hopefully now you understand what bootstrapping is
‫and all the necessary commands to make CDK work.
‫I hope you liked it and I will see you in the next lecture.