WEBVTT - This file was automatically generated by VIMEO

0
00:00:07.100 --> 00:00:10.500
In this video, we're gonna learn about Cloud computing's most valuable

1
00:00:10.500 --> 00:00:12.300
 resource elastic cloud computing.

2
00:00:13.300 --> 00:00:17.300
Elastic cloud computing or commonly known as ec2 is

3
00:00:16.300 --> 00:00:19.800
 a cloud component that provides scalable virtual

4
00:00:19.800 --> 00:00:20.800
 servers on demand.

5
00:00:21.700 --> 00:00:24.400
There are many different os's like Linux Mac and

6
00:00:24.400 --> 00:00:27.300
 windows. You can choose from to run in your ec2 instance.

7
00:00:27.300 --> 00:00:30.200
 Another powerful feature of ec2 is you

8
00:00:30.200 --> 00:00:33.900
 can pick it choose different memory storage and CPU configuration

9
00:00:33.900 --> 00:00:35.500
 for your virtual instance.

10
00:00:36.300 --> 00:00:39.300
Prices and Hardware will vary depending on whichever you

11
00:00:39.300 --> 00:00:39.400
 choose.

12
00:00:40.700 --> 00:00:43.500
Ec2 can either be built as on-demand pricing

13
00:00:43.500 --> 00:00:46.800
 or you could pay ahead of time for a significant discount in

14
00:00:46.800 --> 00:00:47.600
 the reserved model.

15
00:00:49.300 --> 00:00:52.000
To better understand your lab environment. You will need to

16
00:00:52.200 --> 00:00:56.200
 learn where to find ec2 instances inside AWS console

17
00:00:55.200 --> 00:00:58.000
 and explore some of its attributes.

18
00:00:58.800 --> 00:01:01.900
After that, you open up our final terraform file

19
00:01:01.900 --> 00:01:04.300
 to piece together the resource in the code needed

20
00:01:04.300 --> 00:01:07.700
 to create one. Okay, let's get started. All right,

21
00:01:07.700 --> 00:01:10.600
 here. We are back in our web browser

22
00:01:10.600 --> 00:01:12.700
 again inside the AWS console.

23
00:01:13.400 --> 00:01:16.200
Since we're gonna be talking about ec2, we don't need to go to

24
00:01:16.200 --> 00:01:19.400
 VPC any longer, but the same Rule still

25
00:01:19.400 --> 00:01:22.800
 apply. We'll go up here. We're going to search for ec2.

26
00:01:23.400 --> 00:01:26.200
And it should be our top result here as you can see. I'll click

27
00:01:26.200 --> 00:01:26.900
 on ec2.

28
00:01:27.700 --> 00:01:30.300
And here we go. So just like the other

29
00:01:30.300 --> 00:01:33.700
 resources you saw earlier. Here's our main ec2 page

30
00:01:33.700 --> 00:01:37.000
 and all the drill Downs

31
00:01:36.100 --> 00:01:39.500
 that it provides. There's obviously quite

32
00:01:39.500 --> 00:01:42.300
 a few attribute our few components

33
00:01:42.300 --> 00:01:45.200
 that are inside the ec2 umbrella here. We're only gonna

34
00:01:45.200 --> 00:01:48.600
 talk about ec2 instances for right now as a that's just

35
00:01:48.600 --> 00:01:51.200
 what this course is laid out for but I encourage you to

36
00:01:51.200 --> 00:01:54.400
 learn more first thing you should notice is that this is only showing

37
00:01:54.400 --> 00:01:57.700
 us ec2 instances and ec2 other components

38
00:01:57.700 --> 00:02:00.400
 running in the US West 2 region

39
00:02:00.400 --> 00:02:03.900
 as this is the one that we're going to use for our demo. You can

40
00:02:03.900 --> 00:02:06.300
 see here that's up here on my cursor is an organ

41
00:02:06.300 --> 00:02:08.200
 this highlighted. That means we're in us with two

42
00:02:08.700 --> 00:02:11.400
If by any chance that you had ec2 instances is

43
00:02:11.400 --> 00:02:14.500
 running in different regions, you would use this ec2 global

44
00:02:14.500 --> 00:02:17.200
 view right here, which would bring you to a

45
00:02:17.200 --> 00:02:20.700
 global view to show you all your ec2 runs in ec2 instances running

46
00:02:20.700 --> 00:02:23.300
 across the world down the left-hand. We have

47
00:02:23.300 --> 00:02:26.900
 a lot more components like I was saying to do

48
00:02:26.900 --> 00:02:29.300
 it easy to but we're gonna skip all those we're

49
00:02:29.300 --> 00:02:32.200
 gonna just focus on instances and so over here

50
00:02:32.200 --> 00:02:35.800
 on the left. We're gonna say instances, although probably really

51
00:02:35.800 --> 00:02:38.300
 quick to talk about right here is you have instances running in

52
00:02:38.300 --> 00:02:41.600
 instances. The difference between these two is these are

53
00:02:41.600 --> 00:02:44.600
 actually running and you can interact with them. These are

54
00:02:44.600 --> 00:02:47.900
 instances you have but that may be in a stopped State. All

55
00:02:47.900 --> 00:02:50.400
 right, perfect. So let's click over here on instances.

56
00:02:51.500 --> 00:02:54.800
Okay. So here's all the actual instances that

57
00:02:54.800 --> 00:02:58.000
 would be for this region for Usos

58
00:02:57.100 --> 00:03:00.200
 2 as you can see, there's none here and at the

59
00:03:00.200 --> 00:03:03.700
 top you can see that there is these headers into the

60
00:03:03.700 --> 00:03:06.500
 state instance type status check alarm status. Those will

61
00:03:06.500 --> 00:03:09.400
 come a little bit more familiar with you once you we spend

62
00:03:09.400 --> 00:03:09.900
 one up and see.

63
00:03:10.500 --> 00:03:13.200
Down here because we don't have any instances you

64
00:03:13.200 --> 00:03:17.000
 can see down here in the details pain that is not here. There's

65
00:03:16.600 --> 00:03:19.800
 nothing to go on the normal resource

66
00:03:19.800 --> 00:03:22.600
 configuration up here. You have launch instance, which

67
00:03:22.600 --> 00:03:25.700
 is a wizard which I am gonna show you this one because

68
00:03:25.700 --> 00:03:28.300
 I think it's important to map this to what we see in the terraform file.

69
00:03:28.300 --> 00:03:31.400
 You see the actions button here,

70
00:03:31.400 --> 00:03:35.300
 which if we want to like modify or delete an instance

71
00:03:34.300 --> 00:03:37.600
 and then this instant State drop down right

72
00:03:37.600 --> 00:03:40.700
 here, it allows you to stop start reboot hibernate or

73
00:03:40.700 --> 00:03:43.300
 terminated instance. Of course, if you have one to click

74
00:03:43.300 --> 00:03:45.400
 on since we have none, they're all grayed out.

75
00:03:46.400 --> 00:03:50.000
All right. So let's go ahead we're gonna click over here this launch instance wizard.

76
00:03:51.400 --> 00:03:54.000
Okay. So here we are and this is

77
00:03:54.200 --> 00:03:57.500
 the aws's ec2 wizard. We'll launch

78
00:03:57.500 --> 00:04:00.400
 in instance and here the first thing you should notice is the name

79
00:04:00.400 --> 00:04:03.200
 and tags little card here. And this is just like we

80
00:04:03.200 --> 00:04:06.300
 saw on the terraform file the tag with the name and the

81
00:04:06.300 --> 00:04:09.400
 value. So here you would put whatever you

82
00:04:09.400 --> 00:04:12.100
 wanted. This next card here is they want to

83
00:04:12.100 --> 00:04:16.100
 know the OS images here. It just automatically highlights

84
00:04:15.100 --> 00:04:18.300
 Amazon Linux and you have it

85
00:04:18.300 --> 00:04:21.400
 right here, which you have the kernel the type

86
00:04:21.400 --> 00:04:25.000
 64-bit architecture on x86. That's

87
00:04:24.200 --> 00:04:27.200
 the actually one we're gonna use in our in our

88
00:04:27.200 --> 00:04:30.100
 lab as well. But here just automatically picks it for you, but you

89
00:04:30.100 --> 00:04:33.300
 could pick a bun to Red Hat Mac OS Windows, whichever

90
00:04:33.300 --> 00:04:34.200
 one you wanted to do.

91
00:04:34.900 --> 00:04:37.600
Next card we go through is instance type.

92
00:04:37.600 --> 00:04:40.300
 So this is the type of machine that you want to spin up and

93
00:04:40.300 --> 00:04:43.200
 this is the CPU memory configurations. I was

94
00:04:43.200 --> 00:04:46.200
 talking about because we're gonna stick with the free tier. So

95
00:04:46.200 --> 00:04:49.600
 it doesn't cost you any money. We are gonna stick with the t2 micro

96
00:04:49.600 --> 00:04:52.600
 which is the free tier eligible. Like it says right here and the

97
00:04:52.600 --> 00:04:55.500
 t2 has one virtual CPU and one gig of

98
00:04:55.500 --> 00:04:58.600
 memory, which is plenty for us for our

99
00:04:58.600 --> 00:05:01.300
 purposes here for this lab. The next card down

100
00:05:01.300 --> 00:05:02.000
 is key pair.

101
00:05:02.600 --> 00:05:05.700
So when you spin up a Linux ec2 instance,

102
00:05:05.700 --> 00:05:08.200
 you need to be able to access it in one

103
00:05:08.200 --> 00:05:08.300
 way.

104
00:05:09.300 --> 00:05:12.200
You can access it is over SSH and is that that's the exact way

105
00:05:12.200 --> 00:05:14.000
 that we're gonna access it as well.

106
00:05:14.800 --> 00:05:17.400
Amazon would rather and the industry

107
00:05:17.400 --> 00:05:20.600
 would rather you access these Linux servers

108
00:05:20.600 --> 00:05:23.100
 using an SSH key pair of just user password.

109
00:05:24.100 --> 00:05:27.200
So what it's asking for here is saying hey, do you already have a

110
00:05:27.200 --> 00:05:30.100
 key pair? You can use or we can create a new one by this little

111
00:05:30.100 --> 00:05:33.100
 designation here. And this will make more sense when we look at

112
00:05:33.100 --> 00:05:36.300
 the terraform file and we're gonna use our own key pair.

113
00:05:36.300 --> 00:05:39.000
 So when we spin it up, we'll be able

114
00:05:39.600 --> 00:05:42.700
 to ssh in so here in this network settings card. So

115
00:05:42.700 --> 00:05:45.700
 some of this information should look familiar to you here. It's

116
00:05:45.700 --> 00:05:48.700
 picking our VPC. Now, this is the default VPC not

117
00:05:48.700 --> 00:05:51.400
 our lab one that we're gonna create because it's

118
00:05:51.400 --> 00:05:54.200
 the only one that it can pick if there was multiple ones you

119
00:05:54.200 --> 00:05:57.800
 could edit here and select the different one. The subnet

120
00:05:57.800 --> 00:06:00.400
 is just there's no preference. This is gonna pick a random one

121
00:06:00.400 --> 00:06:03.600
 in our lab. We are going to actually assign one here.

122
00:06:03.600 --> 00:06:06.300
 We see the auto assign public IP, which you should

123
00:06:06.300 --> 00:06:09.700
 look familiar to you. It's enabled here we get to security groups.

124
00:06:09.700 --> 00:06:12.200
 And if you didn't have a security group, you could

125
00:06:12.200 --> 00:06:15.100
 create one on the Fly here instead of having to go to the

126
00:06:15.100 --> 00:06:17.900
 security group AWS Resource page and then back here.

127
00:06:18.700 --> 00:06:21.300
Or you can select from existing one and so

128
00:06:21.300 --> 00:06:24.300
 obviously we're gonna create our own Security Group and we're gonna sign

129
00:06:24.300 --> 00:06:25.800
 that to the ec2 instance.

130
00:06:26.600 --> 00:06:29.300
Next you can see the last part here is configure storage

131
00:06:29.300 --> 00:06:33.700
 and what for the free tier basically you

132
00:06:32.700 --> 00:06:35.300
 can get up to 30 gigabytes of

133
00:06:35.300 --> 00:06:36.100
 free tier right now.

134
00:06:36.900 --> 00:06:39.200
And as you can see here the default that

135
00:06:39.200 --> 00:06:42.200
 it picked for us was an eight gig root hard drive with using

136
00:06:42.200 --> 00:06:45.300
 gp2 and gp2 is basically the type

137
00:06:45.300 --> 00:06:48.200
 of volume it is and when that comes

138
00:06:48.200 --> 00:06:51.500
 down to is how fast is this disc gonna be for us and so all

139
00:06:51.500 --> 00:06:54.400
 these defaults are fine. And if we were

140
00:06:54.400 --> 00:06:57.700
 to ready to go we would click launch instance and

141
00:06:57.700 --> 00:07:00.200
 then within a few seconds within I think it's about

142
00:07:00.200 --> 00:07:03.500
 30 seconds. You would have a running Lennox Amazon

143
00:07:03.500 --> 00:07:06.400
 Linux instance that you could interact with. So I'm gonna

144
00:07:06.400 --> 00:07:09.500
 click cancel here because we're obviously we're not gonna do the wizard, but I

145
00:07:09.500 --> 00:07:12.900
 just wanted you to see all the the values in

146
00:07:12.900 --> 00:07:15.100
 the attributes needed to actually spin up

147
00:07:15.100 --> 00:07:18.400
 an ec2 instant. All right, so I'm gonna stop here

148
00:07:18.400 --> 00:07:21.200
 with ec2 instances because there's a lot

149
00:07:21.200 --> 00:07:24.400
 more going on here and it's definitely Beyond this course,

150
00:07:24.400 --> 00:07:27.500
 but I wanted to get an overview of what the main

151
00:07:27.500 --> 00:07:30.200
 page look like and and The Wizard if you

152
00:07:30.200 --> 00:07:33.200
 ever needed to do it through the UI, so from here, let's go

153
00:07:33.200 --> 00:07:36.800
 ahead and jump over into the terminal and then let's look at the ec2 Terra.

154
00:07:36.800 --> 00:07:37.200
file

155
00:07:37.800 --> 00:07:41.200
Alright, so here we are back in the terminal and I'm

156
00:07:40.200 --> 00:07:44.100
 going to open up our ec2.tf file

157
00:07:43.100 --> 00:07:44.200
 here.

158
00:07:52.900 --> 00:07:56.700
Here we are back on Terminal again. I'm going to open up our ec2.tf

159
00:07:55.700 --> 00:07:56.900
 file.

160
00:07:59.800 --> 00:08:02.500
Okay, so as we saw in the last

161
00:08:02.500 --> 00:08:05.100
 video this resource has got

162
00:08:05.100 --> 00:08:08.400
 a lot going on because as you saw through the wizard and the AWS

163
00:08:08.400 --> 00:08:11.600
 console is quite a few things. We need to to fill

164
00:08:11.600 --> 00:08:14.300
 out to be able to spin up an ec2 instance. Now

165
00:08:14.300 --> 00:08:17.600
 some of these are defaults and I didn't need to include them but I

166
00:08:17.600 --> 00:08:20.500
 did it for explicitness. So you have an

167
00:08:20.500 --> 00:08:23.500
 understanding of what you can and cannot manipulate. And in

168
00:08:23.500 --> 00:08:26.700
 fact, there's even more options here even in

169
00:08:26.700 --> 00:08:29.100
 the eight of us console. There's an advanced section down below that I

170
00:08:29.100 --> 00:08:32.600
 didn't go into but there's more things you can change but let's

171
00:08:32.600 --> 00:08:34.100
 go over this and let's talk about

172
00:08:35.100 --> 00:08:36.500
It just looks like so here we are.

173
00:08:37.500 --> 00:08:40.300
Same thing. Hopefully you're becoming familiar.

174
00:08:40.300 --> 00:08:43.300
 When you're seeing this now. We have the resource declaration. We're gonna use

175
00:08:43.300 --> 00:08:46.700
 the instance terraform AWS provider

176
00:08:46.700 --> 00:08:49.500
 Library here. We're gonna name this resource lab

177
00:08:49.500 --> 00:08:52.100
 1 and that's important and I'll show you in a minute

178
00:08:52.100 --> 00:08:52.600
 why it is

179
00:08:53.400 --> 00:08:56.600
Line two here. We're picking the Ami, which is just

180
00:08:56.600 --> 00:08:59.800
 the machine instance and what the

181
00:08:59.800 --> 00:09:02.600
 what this does is just says, hey we want to use this version

182
00:09:02.600 --> 00:09:05.400
 of Linux or we want to use this version of mac. And this

183
00:09:05.400 --> 00:09:08.500
 is what we're gonna spin up in in the instance and here

184
00:09:08.500 --> 00:09:11.300
 we're using a variable we're using the VAR dot

185
00:09:11.300 --> 00:09:14.200
 Ami syntax sugar here and for the

186
00:09:14.200 --> 00:09:17.500
 terraform and that's because that's because we've hard coded the Amazon

187
00:09:17.500 --> 00:09:20.600
 Linux Ami in another file called vars

188
00:09:20.600 --> 00:09:23.700
 and I'm actually gonna we're gonna look at that as we

189
00:09:23.700 --> 00:09:26.200
 go through this too since we haven't covered it before.

190
00:09:27.500 --> 00:09:30.200
I'm gonna pick the instance type here which we talked about in the

191
00:09:30.200 --> 00:09:32.100
 80 was console is going to be the t2 micro.

192
00:09:33.300 --> 00:09:36.200
Here we're picking our subnet. And if you remember from the subnet

193
00:09:36.200 --> 00:09:39.400
 video, we called our subnet sub lab subnet

194
00:09:39.400 --> 00:09:42.700
 public one and here is exactly pulling that

195
00:09:42.700 --> 00:09:45.400
 out. It's saying hey, we named that resource not

196
00:09:45.400 --> 00:09:48.500
 the actual name of the subnet. But the name of the resource.

197
00:09:48.500 --> 00:09:51.200
 Is this lab subnet public

198
00:09:51.200 --> 00:09:51.400
 one?

199
00:09:52.500 --> 00:09:55.800
Here you can we can apply a list

200
00:09:55.800 --> 00:09:58.400
 or an array of Security Group

201
00:09:58.400 --> 00:10:01.600
 IDs for the VPC since we've only created One Security

202
00:10:01.600 --> 00:10:04.700
 Group, which was the allow SSH HTTP or

203
00:10:04.700 --> 00:10:07.600
 putting that in here and we're using the string interpolation the

204
00:10:07.600 --> 00:10:10.600
 dollar sign Curly's like we saw in the past videos.

205
00:10:11.600 --> 00:10:14.200
So this is the one that went out

206
00:10:14.200 --> 00:10:17.500
 we on the AWS console online 12 here, which is key name.

207
00:10:18.200 --> 00:10:21.300
This is the one we saw with a key pair and this is where we have

208
00:10:21.300 --> 00:10:24.900
 an option to upload our own SSH

209
00:10:24.900 --> 00:10:27.500
 key pair to the ec2 EC

210
00:10:27.500 --> 00:10:30.400
 to Amazon and the ec2 instance so we can SSH into

211
00:10:30.400 --> 00:10:33.700
 it and how this works it basically only

212
00:10:33.700 --> 00:10:36.700
 uploads the public key. We

213
00:10:36.700 --> 00:10:39.300
 keep the private and uploads the public key in

214
00:10:39.300 --> 00:10:42.800
 that public key will be put inside that amet that ec2 instance

215
00:10:42.800 --> 00:10:45.400
 when it's launched and that's how we'll be on be

216
00:10:45.400 --> 00:10:48.500
 able to authenticate ourselves to that instance. And so

217
00:10:48.500 --> 00:10:51.700
 this key keyname right here is mapping to

218
00:10:51.700 --> 00:10:54.400
 the resource online starting online 33, which will

219
00:10:54.400 --> 00:10:55.400
 cover in a second here.

220
00:10:56.700 --> 00:11:00.800
Here we're setting the availability Zone. And basically we've

221
00:11:00.800 --> 00:11:03.600
 hard coded you. I've hard coded Us West 2A

222
00:11:03.600 --> 00:11:06.100
 into a variable into the vars file and I'll show

223
00:11:06.100 --> 00:11:06.700
 you that in a second.

224
00:11:07.900 --> 00:11:10.200
This should be looked from a

225
00:11:10.200 --> 00:11:13.300
 little familiar as well. We're associating a public IP address to true

226
00:11:13.300 --> 00:11:16.100
 on this because we want this ec2 instance when it comes

227
00:11:16.100 --> 00:11:17.900
 up to actually have a public IP address.

228
00:11:19.100 --> 00:11:22.100
On line 20. This is the root block device. So this is the

229
00:11:22.100 --> 00:11:25.000
 root device. And if you remember from the AWS console part, we

230
00:11:25.300 --> 00:11:28.300
 were looking at it had the it allows you

231
00:11:28.300 --> 00:11:30.900
 to pick the size of the root part the root device and

232
00:11:32.100 --> 00:11:35.400
The type which was the gp2. So here this is

233
00:11:35.400 --> 00:11:38.300
 all optional. It would have already picked the eight gig

234
00:11:38.300 --> 00:11:41.500
 the gp2 by default. But because I wanted

235
00:11:41.500 --> 00:11:44.200
 to show a little bit more here. I went ahead and

236
00:11:44.200 --> 00:11:47.300
 from lines 20 to 25 to show you that you can

237
00:11:47.300 --> 00:11:50.600
 set up your own root volume different sizes different

238
00:11:50.600 --> 00:11:53.300
 speeds and the biggest part here

239
00:11:53.300 --> 00:11:56.300
 is line 21, which is the delete on termination this means

240
00:11:56.300 --> 00:11:59.900
 whenever we destroy the ec2 instance,

241
00:11:59.900 --> 00:12:02.200
 we create it'll actually make sure that there's no

242
00:12:02.200 --> 00:12:05.500
 root device left around as well and obviously

243
00:12:05.500 --> 00:12:07.500
 because that could cost money and for security reasons

244
00:12:09.100 --> 00:12:12.700
So here we get them down to our tags lines 27 through

245
00:12:12.700 --> 00:12:15.600
 30. And this time we did a little something a little different on line

246
00:12:15.600 --> 00:12:18.500
 28. You see the normal name tag, which is lab one,

247
00:12:18.500 --> 00:12:21.400
 which is what we're gonna call this ec2 instance. But I've added

248
00:12:21.400 --> 00:12:24.500
 this other tag here called environment and we were just

249
00:12:24.500 --> 00:12:27.000
 set it as lab and the reason why I wanted to do this is show you

250
00:12:27.100 --> 00:12:30.500
 is that if you had a bunch of development servers or

251
00:12:30.500 --> 00:12:33.500
 a bunch of staging or Production Service, you could add

252
00:12:33.500 --> 00:12:36.400
 a different tag for them. So you could group them together for easy

253
00:12:36.400 --> 00:12:39.500
 searching or if you wanted to apply some different rules. You

254
00:12:39.500 --> 00:12:42.500
 could apply them to all with this tag. That's obviously a

255
00:12:42.500 --> 00:12:45.400
 little bit more advanced, but I wanted to show you that instead of

256
00:12:45.400 --> 00:12:48.200
 keep showing you the name tag over and over. I wanted to show you something a little bit different.

257
00:12:49.200 --> 00:12:52.400
Okay. So let's go to line 33 here. And this is where

258
00:12:52.400 --> 00:12:55.300
 we're actually creating the key pair and we're using

259
00:12:55.300 --> 00:12:59.600
 the same resource and we're using the AWS key pair library

260
00:12:58.600 --> 00:13:01.500
 from the AWS provider and terraform

261
00:13:01.500 --> 00:13:04.600
 and we're naming this resource lab region

262
00:13:04.600 --> 00:13:07.600
 key pair and if you look right there online 33 we

263
00:13:07.600 --> 00:13:10.100
 call this resource labradget key pair. If you

264
00:13:10.100 --> 00:13:14.100
 come up back up to line 12 again, you can see that where

265
00:13:13.100 --> 00:13:16.500
 are we are referencing the

266
00:13:16.500 --> 00:13:19.500
 we're referencing the resource name up there and that's

267
00:13:19.500 --> 00:13:20.900
 how it knows where to find it.

268
00:13:22.400 --> 00:13:25.400
So we'll go down here line 34 just the

269
00:13:25.400 --> 00:13:28.200
 key Name Lab region key pair and then here we're

270
00:13:28.200 --> 00:13:31.800
 using this terraform built-in function called file and

271
00:13:31.800 --> 00:13:34.400
 it's just basically gonna take in a local file on

272
00:13:34.400 --> 00:13:38.000
 path and it is that's what's going to be uploaded. I

273
00:13:37.100 --> 00:13:40.700
 will show you the variable where this is the varda public

274
00:13:40.700 --> 00:13:43.700
 keypath later the name of this is hardcoded because

275
00:13:43.700 --> 00:13:46.200
 I've I've included a script for you to run

276
00:13:46.200 --> 00:13:49.400
 that'll actually create the keep here for use and it'll actually name the

277
00:13:49.400 --> 00:13:52.300
 key pair or something. So you do not have to worry about

278
00:13:52.300 --> 00:13:54.800
 the names it all just match up to work for you.

279
00:13:55.800 --> 00:13:58.200
Now here's something we haven't done before and I

280
00:13:58.200 --> 00:14:01.400
 wanted to add this and I'll show you why because it's gonna make it lives a

281
00:14:01.400 --> 00:14:04.500
 little easier at the end. This is output. So it's not a resource but

282
00:14:04.500 --> 00:14:07.800
 an output and so with this basically says is that terraform is

283
00:14:07.800 --> 00:14:10.400
 gonna spit something out to the terminal when it's done

284
00:14:10.400 --> 00:14:13.400
 and what we're trying to do here. We're getting the

285
00:14:13.400 --> 00:14:16.400
 lab one ec2 instance. We're gonna

286
00:14:16.400 --> 00:14:19.300
 reach in and get the public IP. Once that server is

287
00:14:19.300 --> 00:14:22.900
 up and running the virtual instance up and running. We're gonna get the virtual IP

288
00:14:22.900 --> 00:14:25.200
 here. I mean the public IP here and then we're gonna

289
00:14:25.200 --> 00:14:28.300
 put that out to screen. That'll just make it nice little it'll make it easy for

290
00:14:28.300 --> 00:14:31.900
 you when it's time to SSH and do it. You'll have it on the screen. You don't have to go searching

291
00:14:31.900 --> 00:14:34.200
 through the AWS console to find it. Okay.

292
00:14:34.900 --> 00:14:38.300
So there is our ec2tf

293
00:14:37.300 --> 00:14:40.100
 file but what I wanted to show you

294
00:14:40.100 --> 00:14:43.300
 I'm gonna put it side by side here. Is this variables file?

295
00:14:43.300 --> 00:14:46.300
 And so it's just in a file called vars that TF. There's

296
00:14:46.300 --> 00:14:49.300
 nothing special about this file. You could have added them to any of

297
00:14:49.300 --> 00:14:52.100
 these other files, but I like say I like separation. So it's a little

298
00:14:52.100 --> 00:14:53.300
 bit easier to explain

299
00:14:54.200 --> 00:14:57.500
And if you look over here on this left column, you can see that all

300
00:14:57.500 --> 00:15:00.200
 these are just variables that we're using through

301
00:15:00.200 --> 00:15:03.500
 all the terraform files and the one variable is

302
00:15:03.500 --> 00:15:06.600
 called AWS region and it's set to Usos 2. You

303
00:15:06.600 --> 00:15:09.400
 have another variable called a z which is defaults to

304
00:15:09.400 --> 00:15:12.800
 us West 2A and then here is that keypath. So

305
00:15:12.800 --> 00:15:15.900
 on the right column, you can see on

306
00:15:15.900 --> 00:15:18.100
 line 34 on there on

307
00:15:18.100 --> 00:15:21.200
 the right column key name you can see that I'm sorry

308
00:15:21.200 --> 00:15:24.900
 on line 35 where it says public key and it says VAR Dot

309
00:15:24.900 --> 00:15:25.500
 Public keypath

310
00:15:26.600 --> 00:15:29.900
It's basically getting this right here and then inserting

311
00:15:29.900 --> 00:15:32.200
 the name here. It's looking for

312
00:15:32.200 --> 00:15:35.100
 that file on disk local in this

313
00:15:35.100 --> 00:15:38.400
 case of lab key pair and that does get when I told

314
00:15:38.400 --> 00:15:41.600
 you we created with that the bash grip that will get created and

315
00:15:41.600 --> 00:15:44.300
 that will be there. So we need to create them before we

316
00:15:44.300 --> 00:15:47.200
 run terraform, but we'll do that in the next video. And then here's

317
00:15:47.200 --> 00:15:50.400
 the Ami which we were talking about the machine

318
00:15:50.400 --> 00:15:50.800
 image.

319
00:15:51.700 --> 00:15:54.500
And this ID right here, I just went to

320
00:15:54.500 --> 00:15:57.600
 Amazon search for images and found the Amazon Linux

321
00:15:57.600 --> 00:16:00.200
 2 image Ami for you in Usos 2,

322
00:16:00.200 --> 00:16:03.500
 and I just picked that one nothing special there,

323
00:16:03.500 --> 00:16:05.300
 but it allows us to use this now.

324
00:16:05.900 --> 00:16:08.800
The variables make a little easier for separation

325
00:16:08.800 --> 00:16:11.400
 concerns. Also, if I need to change something instead of

326
00:16:11.400 --> 00:16:14.600
 having to change an ID or an Ami somewhere

327
00:16:14.600 --> 00:16:17.100
 in a bunch of different files. I have to change it one place because

328
00:16:17.100 --> 00:16:19.000
 terraform will compile all this for us.

329
00:16:19.800 --> 00:16:21.700
All right, let's close that file.

330
00:16:22.400 --> 00:16:26.000
Go ahead and get out of here, too. We're done in looking

331
00:16:25.100 --> 00:16:28.500
 at the terraform file. And so let's

332
00:16:28.500 --> 00:16:31.100
 head back over and let's recap what we've done so far.

333
00:16:32.200 --> 00:16:36.000
Okay. So what we learned about so far in this video, we've learned

334
00:16:35.700 --> 00:16:38.500
 about ec2 and some of its features like you

335
00:16:38.500 --> 00:16:41.400
 could configure memory and CPU options in different

336
00:16:41.400 --> 00:16:44.700
 instance types you explored ec2's interface

337
00:16:44.700 --> 00:16:47.200
 inside AWS console and got a

338
00:16:47.200 --> 00:16:50.600
 glimpse at some of the metadata needed to create one. Finally you

339
00:16:50.600 --> 00:16:53.400
 open the terraform file that would create a Linux server

340
00:16:53.400 --> 00:16:56.400
 for the lab. You also got to learn a little bit about using

341
00:16:56.400 --> 00:16:59.100
 a vars file to make things a little bit nice and neat.

342
00:17:00.500 --> 00:17:03.400
In the next video You're gonna put all

343
00:17:03.400 --> 00:17:06.300
 this knowledge together and you're finally gonna create your

344
00:17:06.300 --> 00:17:06.700
 lab.

345
00:17:07.700 --> 00:17:08.200
See you soon.
