1
00:00:00,420 --> 00:00:08,520
In this video, we are going to bootstrapping the CDK application, but before that we should understand

2
00:00:08,520 --> 00:00:13,170
why we should bootstrapping the CDK application before we start.

3
00:00:13,800 --> 00:00:20,190
If you look at the image on the slide, you can see the lifecycle of the CDK application and it is required

4
00:00:20,190 --> 00:00:23,970
to bootstrap CDK application at the beginning of the project.

5
00:00:24,870 --> 00:00:31,050
So basically when we developed our codes with the familiar languages like TypeScript and developing

6
00:00:31,050 --> 00:00:38,020
the infrastructure codes, these codes need to be synthesized and convert to the cloud formation templates.

7
00:00:38,040 --> 00:00:43,560
And after that, it can be deployed the infrastructure with using the cloud formation.

8
00:00:43,950 --> 00:00:45,180
You can see the image.

9
00:00:45,510 --> 00:00:48,450
This is the our source code of the CDK application.

10
00:00:48,690 --> 00:00:51,120
And let me show this CDK application.

11
00:00:51,780 --> 00:00:57,840
If you open the hour, which is pseudocode, you can see an example halo CD application in here.

12
00:00:57,990 --> 00:00:59,340
And think about that.

13
00:00:59,340 --> 00:01:01,590
We have some constructs in here.

14
00:01:01,590 --> 00:01:08,670
We are going to create some squares as three or SNS resources in our CD application.

15
00:01:08,910 --> 00:01:17,640
And after that, if you come back to our slide, this application is comes to CD Oxley and CDK running

16
00:01:17,640 --> 00:01:21,990
this case in command and this will be create a cloud formation template.

17
00:01:21,990 --> 00:01:28,890
And after that running the CDK deploy command, this will be deploying the OR Adobe resources in the

18
00:01:28,890 --> 00:01:33,240
target list cloud environment be using data with this cloud formation.

19
00:01:33,360 --> 00:01:37,170
This is the lifecycle of the CD K application.

20
00:01:38,340 --> 00:01:44,280
But during this process, all these codes and cloud formation templates, you can see we have several

21
00:01:44,280 --> 00:01:52,080
code files and the cloud formation templates should be stored in Amazon S3 So this will require to bootstrapping

22
00:01:52,080 --> 00:01:54,870
CD application at the beginning of the project.

23
00:01:56,390 --> 00:01:58,210
CDK has bootstrap command.

24
00:01:58,220 --> 00:01:59,570
That is really important.

25
00:01:59,600 --> 00:02:06,290
This command should be run before we start deploying our CDK stacks and this will only run the first

26
00:02:06,290 --> 00:02:08,240
time before deploying the applications.

27
00:02:08,630 --> 00:02:14,210
So you can think that this is the prerequisite step for deploying CDK applications.

28
00:02:14,510 --> 00:02:19,310
So we should bootstrap first and after that we can continue our CDK deployments.

29
00:02:20,090 --> 00:02:23,480
Let me try to explain what is the CDK bootstrapping?

30
00:02:23,570 --> 00:02:28,220
It is basically proliferation of our CDK deployments.

31
00:02:28,460 --> 00:02:36,170
It is required to bootstrap command because we also need to store our codes and the configurations in

32
00:02:36,170 --> 00:02:38,350
another management cloud formation state.

33
00:02:38,690 --> 00:02:44,090
So you can see in here we have a code files and we have CDK configurations.

34
00:02:44,210 --> 00:02:51,110
ADA is required to store in this code file and our configuration in a separate management cloud formation

35
00:02:51,110 --> 00:02:56,090
state in order to follow our CDK operations and managements.

36
00:02:56,450 --> 00:03:00,620
So let me open the cloud formation from the ADA management console.

37
00:03:00,770 --> 00:03:06,440
If you open the ADA Willis console, you can come here and search cloud formation.

38
00:03:07,660 --> 00:03:15,100
It's more that cloud formation is automation tool that you can create your stakes and infrastructure

39
00:03:15,130 --> 00:03:15,850
escorts.

40
00:03:16,000 --> 00:03:20,410
You can see the stakes in the cloud formation if you click in here.

41
00:03:21,010 --> 00:03:23,440
We have no defined end stakes yet.

42
00:03:23,920 --> 00:03:31,600
So that means this is not CDK bootstrapped and we didn't deploy anything in our cloud formation.

43
00:03:32,770 --> 00:03:37,920
So there is no stake in our cloud formation in order to deploy our seed stakes.

44
00:03:37,960 --> 00:03:44,860
We should first run the CDK Bootstrap Command and this command will create a management stack in here

45
00:03:44,860 --> 00:03:52,030
and that management stake will store all our codes and configurations with our infrastructure code,

46
00:03:52,030 --> 00:03:54,650
which is including from the zip code.

47
00:03:54,700 --> 00:04:01,450
So that means once we are running the CDK Bootstrap Command, these codes and all, all our complications

48
00:04:01,450 --> 00:04:06,160
will be stored an additional stack in here for the CDK management stake.

49
00:04:06,190 --> 00:04:12,550
And after that we can power from deployments and deployments will be create an additional stake for

50
00:04:12,550 --> 00:04:15,280
the particular project of our application.

51
00:04:15,720 --> 00:04:18,190
Okay, so don't be overloaded.

52
00:04:18,220 --> 00:04:23,470
We will see every step, every step together and step by step, no worries.

53
00:04:23,470 --> 00:04:32,130
So we are going to bootstrapping our application for now and we will see how it's happened after that.

54
00:04:32,140 --> 00:04:39,190
When we hit the when we performing the bootstrap command, after we hit the CDK deploy command, then

55
00:04:39,190 --> 00:04:42,400
it will create a an actual stack for our project.

56
00:04:42,400 --> 00:04:52,000
For example, in our project we have a CDK stick+ and at that time when we deploy our project, we will

57
00:04:52,000 --> 00:04:53,110
see the CDK.

58
00:04:53,530 --> 00:05:02,280
Hello CDK Stick+ in here and in this stack maybe we have Amazon s case, S3 Psns and so on.

59
00:05:02,290 --> 00:05:07,840
These resources can be deployed then according to US code definitions.

60
00:05:08,770 --> 00:05:10,270
OC Very good.

61
00:05:10,300 --> 00:05:16,900
In official explanation of the bootstrapping, the CDK application, deploying the SDK application into

62
00:05:17,000 --> 00:05:24,220
the environment required to provision resources the ADA will need to store in some places.

63
00:05:24,220 --> 00:05:26,830
So that means the management places.

64
00:05:27,010 --> 00:05:34,630
So these resources included an Amazon S3 bucket for storing files and in roles and grant permissions

65
00:05:34,630 --> 00:05:37,750
and needed for the performing D deployments.

66
00:05:37,840 --> 00:05:43,690
You can see that CDK required all codes, permissions and other configurations in order to deploy our

67
00:05:43,690 --> 00:05:46,540
stacks in the lifecycle of the CDK.

68
00:05:47,980 --> 00:05:48,970
So very good.

69
00:05:48,970 --> 00:05:56,740
This process of the provisioning is the initial resources of the project and which we call this bootstrapping

70
00:05:56,740 --> 00:05:57,670
the application.

71
00:05:57,910 --> 00:05:59,500
So many will see the case.

72
00:05:59,510 --> 00:06:05,980
Text that you write will include assets, external files that are deployed, deployed with state.

73
00:06:06,490 --> 00:06:09,000
It is also required some additional code files.

74
00:06:09,010 --> 00:06:15,850
For example, we should have a lambda functions and the coordinates and these are the lambda and the

75
00:06:16,170 --> 00:06:20,710
the coordinates also required to move and sort in some place.

76
00:06:20,710 --> 00:06:25,150
So that's why it is required to bootstrapping the CDK upload.

77
00:06:25,150 --> 00:06:33,340
These is lambda and all the codes into the Amazon S3 bucket and they are available for the cloud formation

78
00:06:33,340 --> 00:06:34,570
during the deployment.

79
00:06:34,750 --> 00:06:40,210
So a deployment requires that these containers already exist in the account and region we are deploying

80
00:06:40,210 --> 00:06:40,840
into.

81
00:06:40,840 --> 00:06:45,040
And the creating these items is called bootstrapping.

82
00:06:45,070 --> 00:06:52,150
So I'm, I'm giving to lots of theoretical information, but you should only know that we should once

83
00:06:52,150 --> 00:06:55,960
run the CDK bootstrap before deploying our applications, that's all.

84
00:06:56,380 --> 00:07:03,160
So in order to bootstrap our application, we have one command, which is the CDK Bootstrap Command.

85
00:07:03,960 --> 00:07:05,880
I'm going to open the documentation.

86
00:07:05,910 --> 00:07:12,510
If you come here, you can see that we were in here, which is the tool kit commands, which is the

87
00:07:12,510 --> 00:07:17,280
same URL I will also share in this video's resources.

88
00:07:18,390 --> 00:07:26,660
So basically, if you see the these captions, you can see the bootstrap in your environment section.

89
00:07:26,670 --> 00:07:32,190
And in this section you can see that we need to run CDK Bootstrap Command and also we have different

90
00:07:32,190 --> 00:07:32,640
versions.

91
00:07:32,640 --> 00:07:38,760
You can specify a control more and region, but if you run the only CDK bootstrap, it is getting the

92
00:07:38,760 --> 00:07:40,920
default account number and region.

93
00:07:41,010 --> 00:07:42,540
So let's see.

94
00:07:42,540 --> 00:07:44,280
You can see that it is in here.

95
00:07:44,310 --> 00:07:49,790
This is the first time you deploy an SDK application on the environment.

96
00:07:49,800 --> 00:07:56,310
You have to install your bootstrap state with running the CDK run CDK Bootstrap Command.

97
00:07:56,580 --> 00:08:00,840
This attack includes resources that are used in the toolkit operations.

98
00:08:00,930 --> 00:08:05,700
For example, the stack includes as an S3 bucket that is used to store templates.

99
00:08:05,700 --> 00:08:09,150
Assets are calls during during the deployment process.

100
00:08:10,560 --> 00:08:16,260
So before I run this command, check the cloud formations text as you can see that and verify that we

101
00:08:16,260 --> 00:08:24,510
have not defined any stack yet so we can use the only CDK bootstrap command in order to install bootstrap

102
00:08:24,510 --> 00:08:27,450
stack into our environment with the default settings.

103
00:08:28,070 --> 00:08:29,180
For that reason.

104
00:08:29,600 --> 00:08:33,020
Open your Visual Studio code and.

105
00:08:33,880 --> 00:08:35,320
Start a new terminal.

106
00:08:36,530 --> 00:08:40,150
And make sure that your terminal is under your CDK.

107
00:08:40,910 --> 00:08:44,150
And now I'm going to run Cdcc Bootstrap Command.

108
00:08:45,240 --> 00:08:47,100
You can copy from.

109
00:08:48,790 --> 00:08:49,930
Our documentation.

110
00:08:50,840 --> 00:08:53,630
And paste into the hour.

111
00:08:53,630 --> 00:08:55,580
We just visited the coal terminal.

112
00:08:56,040 --> 00:08:56,510
Okay.

113
00:08:56,540 --> 00:08:57,560
See the cable strip?

114
00:08:57,560 --> 00:09:01,310
I'm not specifying any account number or region hit to enter.

115
00:09:03,100 --> 00:09:05,230
So this will take some time.

116
00:09:05,950 --> 00:09:07,240
We will see that.

117
00:09:08,400 --> 00:09:15,030
This is the first time what we are creating to see the application and yes, see the logs bootstrapping

118
00:09:15,030 --> 00:09:19,110
the environment with this account number and the region name.

119
00:09:19,110 --> 00:09:22,560
So you can see also your default account number and region name.

120
00:09:24,620 --> 00:09:32,270
And this is going to create a staging bucket in the cloud formation with creating some roles S3 buckets

121
00:09:32,270 --> 00:09:33,260
repository.

122
00:09:34,140 --> 00:09:37,440
And you see the whole process in the terminal.

123
00:09:39,390 --> 00:09:41,730
It is basically creating an if stick.

124
00:09:42,650 --> 00:09:43,850
You can see the looks.

125
00:09:43,880 --> 00:09:52,550
This will run the bootstrap command for my account number and region and see that it is created a bucket

126
00:09:52,580 --> 00:09:53,780
under the stack.

127
00:09:55,690 --> 00:10:01,420
So we will wait months till this process is finished.

128
00:10:03,790 --> 00:10:05,050
It takes some time.

129
00:10:06,410 --> 00:10:07,160
Okay.

130
00:10:11,150 --> 00:10:13,820
You can follow the locks in here.

131
00:10:13,820 --> 00:10:14,300
Staging.

132
00:10:14,300 --> 00:10:15,140
Bucket Policy.

133
00:10:15,140 --> 00:10:15,800
Staging.

134
00:10:15,830 --> 00:10:17,030
Image publishing.

135
00:10:17,730 --> 00:10:19,020
Deployment actions.

136
00:10:19,200 --> 00:10:22,500
These are required for the ah yes it is ready.

137
00:10:22,500 --> 00:10:29,460
We have successfully created our operation and finished our bootstrapping to verify that you should

138
00:10:29,460 --> 00:10:34,470
go to the A management console and come to the text refresh.

139
00:10:34,710 --> 00:10:41,250
We can see that it is automatically create this take name which is the Cdcc toolkit and Sotos is create

140
00:10:41,460 --> 00:10:42,120
needed.

141
00:10:42,120 --> 00:10:43,680
You can read the description.

142
00:10:43,680 --> 00:10:49,170
This includes the resources needed to deploy a SDK application into this environment.
