In this video, we are going to bootstrapping the CDK application, but before that we should understand
why we should bootstrapping the CDK application before we start.
If you look at the image on the slide, you can see the lifecycle of the CDK application and it is required
to bootstrap CDK application at the beginning of the project.
So basically when we developed our codes with the familiar languages like TypeScript and developing
the infrastructure codes, these codes need to be synthesized and convert to the cloud formation templates.
And after that, it can be deployed the infrastructure with using the cloud formation.
You can see the image.
This is the our source code of the CDK application.
And let me show this CDK application.
If you open the hour, which is pseudocode, you can see an example halo CD application in here.
And think about that.
We have some constructs in here.
We are going to create some squares as three or SNS resources in our CD application.
And after that, if you come back to our slide, this application is comes to CD Oxley and CDK running
this case in command and this will be create a cloud formation template.
And after that running the CDK deploy command, this will be deploying the OR Adobe resources in the
target list cloud environment be using data with this cloud formation.
This is the lifecycle of the CD K application.
But during this process, all these codes and cloud formation templates, you can see we have several
code files and the cloud formation templates should be stored in Amazon S3 So this will require to bootstrapping
CD application at the beginning of the project.
CDK has bootstrap command.
That is really important.
This command should be run before we start deploying our CDK stacks and this will only run the first
time before deploying the applications.
So you can think that this is the prerequisite step for deploying CDK applications.
So we should bootstrap first and after that we can continue our CDK deployments.
Let me try to explain what is the CDK bootstrapping?
It is basically proliferation of our CDK deployments.
It is required to bootstrap command because we also need to store our codes and the configurations in
another management cloud formation state.
So you can see in here we have a code files and we have CDK configurations.
ADA is required to store in this code file and our configuration in a separate management cloud formation
state in order to follow our CDK operations and managements.
So let me open the cloud formation from the ADA management console.
If you open the ADA Willis console, you can come here and search cloud formation.
It's more that cloud formation is automation tool that you can create your stakes and infrastructure
escorts.
You can see the stakes in the cloud formation if you click in here.
We have no defined end stakes yet.
So that means this is not CDK bootstrapped and we didn't deploy anything in our cloud formation.
So there is no stake in our cloud formation in order to deploy our seed stakes.
We should first run the CDK Bootstrap Command and this command will create a management stack in here
and that management stake will store all our codes and configurations with our infrastructure code,
which is including from the zip code.
So that means once we are running the CDK Bootstrap Command, these codes and all, all our complications
will be stored an additional stack in here for the CDK management stake.
And after that we can power from deployments and deployments will be create an additional stake for
the particular project of our application.
Okay, so don't be overloaded.
We will see every step, every step together and step by step, no worries.
So we are going to bootstrapping our application for now and we will see how it's happened after that.
When we hit the when we performing the bootstrap command, after we hit the CDK deploy command, then
it will create a an actual stack for our project.
For example, in our project we have a CDK stick+ and at that time when we deploy our project, we will
see the CDK.
Hello CDK Stick+ in here and in this stack maybe we have Amazon s case, S3 Psns and so on.
These resources can be deployed then according to US code definitions.
OC Very good.
In official explanation of the bootstrapping, the CDK application, deploying the SDK application into
the environment required to provision resources the ADA will need to store in some places.
So that means the management places.
So these resources included an Amazon S3 bucket for storing files and in roles and grant permissions
and needed for the performing D deployments.
You can see that CDK required all codes, permissions and other configurations in order to deploy our
stacks in the lifecycle of the CDK.
So very good.
This process of the provisioning is the initial resources of the project and which we call this bootstrapping
the application.
So many will see the case.
Text that you write will include assets, external files that are deployed, deployed with state.
It is also required some additional code files.
For example, we should have a lambda functions and the coordinates and these are the lambda and the
the coordinates also required to move and sort in some place.
So that's why it is required to bootstrapping the CDK upload.
These is lambda and all the codes into the Amazon S3 bucket and they are available for the cloud formation
during the deployment.
So a deployment requires that these containers already exist in the account and region we are deploying
into.
And the creating these items is called bootstrapping.
So I'm, I'm giving to lots of theoretical information, but you should only know that we should once
run the CDK bootstrap before deploying our applications, that's all.
So in order to bootstrap our application, we have one command, which is the CDK Bootstrap Command.
I'm going to open the documentation.
If you come here, you can see that we were in here, which is the tool kit commands, which is the
same URL I will also share in this video's resources.
So basically, if you see the these captions, you can see the bootstrap in your environment section.
And in this section you can see that we need to run CDK Bootstrap Command and also we have different
versions.
You can specify a control more and region, but if you run the only CDK bootstrap, it is getting the
default account number and region.
So let's see.
You can see that it is in here.
This is the first time you deploy an SDK application on the environment.
You have to install your bootstrap state with running the CDK run CDK Bootstrap Command.
This attack includes resources that are used in the toolkit operations.
For example, the stack includes as an S3 bucket that is used to store templates.
Assets are calls during during the deployment process.
So before I run this command, check the cloud formations text as you can see that and verify that we
have not defined any stack yet so we can use the only CDK bootstrap command in order to install bootstrap
stack into our environment with the default settings.
For that reason.
Open your Visual Studio code and.
Start a new terminal.
And make sure that your terminal is under your CDK.
And now I'm going to run Cdcc Bootstrap Command.
You can copy from.
Our documentation.
And paste into the hour.
We just visited the coal terminal.
Okay.
See the cable strip?
I'm not specifying any account number or region hit to enter.
So this will take some time.
We will see that.
This is the first time what we are creating to see the application and yes, see the logs bootstrapping
the environment with this account number and the region name.
So you can see also your default account number and region name.
And this is going to create a staging bucket in the cloud formation with creating some roles S3 buckets
repository.
And you see the whole process in the terminal.
It is basically creating an if stick.
You can see the looks.
This will run the bootstrap command for my account number and region and see that it is created a bucket
under the stack.
So we will wait months till this process is finished.
It takes some time.
Okay.
You can follow the locks in here.
Staging.
Bucket Policy.
Staging.
Image publishing.
Deployment actions.
These are required for the ah yes it is ready.
We have successfully created our operation and finished our bootstrapping to verify that you should
go to the A management console and come to the text refresh.
We can see that it is automatically create this take name which is the Cdcc toolkit and Sotos is create
needed.
You can read the description.
This includes the resources needed to deploy a SDK application into this environment.