WEBVTT - This file was automatically generated by VIMEO

0
00:00:06.900 --> 00:00:09.300
In this video, we're going to learn about two new components

1
00:00:09.300 --> 00:00:11.800
 called security groups and internet gateways.

2
00:00:13.100 --> 00:00:16.700
A security group is like a traffic cop that controls the inbound and

3
00:00:16.700 --> 00:00:19.900
 outbound of network packets. For example, you can

4
00:00:19.900 --> 00:00:22.600
 set a rule that allows SSH connections into

5
00:00:22.600 --> 00:00:23.900
 your Linux virtual server.

6
00:00:24.700 --> 00:00:27.500
Security groups are also stateful. This means

7
00:00:27.500 --> 00:00:30.500
 they only allow traffic from already established connections.

8
00:00:31.500 --> 00:00:34.400
Because security groups control inbound and outbound traffic

9
00:00:34.400 --> 00:00:37.000
 you can use allow and deny rules to give you

10
00:00:37.300 --> 00:00:39.700
 a finer grain control when securing your instance.

11
00:00:41.900 --> 00:00:44.800
Internet gateways are a highly available AWS

12
00:00:44.800 --> 00:00:47.300
 resource that enables internet access for your

13
00:00:47.300 --> 00:00:47.900
 VPC.

14
00:00:49.200 --> 00:00:52.500
You only need one internet gateway per VPC and

15
00:00:52.500 --> 00:00:56.600
 a support both ipv4 and IPv6 addresses.

16
00:00:58.200 --> 00:01:01.300
Our plan is to look at the security groups in a gateways

17
00:01:01.300 --> 00:01:02.700
 inside the AWS console.

18
00:01:03.500 --> 00:01:06.300
We will go over where they are at how to

19
00:01:06.300 --> 00:01:09.700
 find them and what attributes they possess. Once we

20
00:01:09.700 --> 00:01:12.300
 were done in the browser. You will head back over to your

21
00:01:12.300 --> 00:01:16.100
 terminal and will open up the security group and internet gateway terraform

22
00:01:15.100 --> 00:01:16.400
 files.

23
00:01:17.100 --> 00:01:20.400
Our goal like before is to put together what

24
00:01:20.400 --> 00:01:23.700
 we learn in the AWS console and how it maps to our infrastructure

25
00:01:23.700 --> 00:01:24.100
 files.

26
00:01:25.200 --> 00:01:26.100
Okay, let's get started.

27
00:01:27.100 --> 00:01:31.600
Okay back in the AWS console and our security

28
00:01:30.600 --> 00:01:33.400
 group and our internet gateway are

29
00:01:33.400 --> 00:01:36.800
 both under the VPC umbrella like our other components. So we

30
00:01:36.800 --> 00:01:39.100
 are going to just go over to VPC here.

31
00:01:39.100 --> 00:01:42.300
 Click it go to the main VPC page, which you

32
00:01:42.300 --> 00:01:45.100
 should be familiar with by now and if we

33
00:01:45.100 --> 00:01:48.400
 look down here on the left bottom pain, we can see security groups right

34
00:01:48.400 --> 00:01:52.500
 under the security tab. I'm right on the security drop-down and

35
00:01:51.500 --> 00:01:53.300
 so give that a click.

36
00:01:54.100 --> 00:01:57.600
Okay. So here we are on the security groups overview page. This

37
00:01:57.600 --> 00:02:00.400
 has all the security groups that are in this account right

38
00:02:00.400 --> 00:02:03.900
 now. There's only one because it's the default one that Amazon created

39
00:02:03.900 --> 00:02:06.000
 when our account was set up. So this is

40
00:02:06.200 --> 00:02:08.900
 our default Security Group. You can think of it that way.

41
00:02:09.400 --> 00:02:12.400
So if we start over here, we have our details tab.

42
00:02:13.100 --> 00:02:15.700
We have inbound rules outbound rules and tags.

43
00:02:16.600 --> 00:02:19.200
The Details page here is a little bit bear not much

44
00:02:19.200 --> 00:02:22.300
 really going on except you can see the security group ID and it's

45
00:02:22.300 --> 00:02:25.400
 the default VPC Security Group. That's probably that's

46
00:02:25.400 --> 00:02:29.100
 all really important here on this front page when we

47
00:02:29.100 --> 00:02:32.000
 get into it. Let's get into the inbound rules and up on rules where I think it's a little

48
00:02:32.100 --> 00:02:32.700
 bit more interesting.

49
00:02:34.400 --> 00:02:37.800
A rule has these attributes laid out here and their name is

50
00:02:37.800 --> 00:02:38.600
 a security group.

51
00:02:39.500 --> 00:02:42.200
Let me why this so it's easier for everybody to see here. This

52
00:02:42.200 --> 00:02:46.300
 is a security rule ID IP version type protocol

53
00:02:45.300 --> 00:02:48.100
 Port range and a source.

54
00:02:48.800 --> 00:02:48.900
so

55
00:02:49.800 --> 00:02:53.000
to have a inbound rule you must complete some

56
00:02:52.200 --> 00:02:56.000
 of these things and obviously you can see IP IP version

57
00:02:55.300 --> 00:02:59.300
 is not filled out. That would be the ipv4 IPv6.

58
00:02:58.300 --> 00:03:01.200
 There's no name because it's

59
00:03:01.200 --> 00:03:04.400
 the default one and here the type is all traffic.

60
00:03:05.400 --> 00:03:08.500
The protocol is all meaning TCP or UDP.

61
00:03:08.500 --> 00:03:11.700
 And the port range is all meaning any port that

62
00:03:11.700 --> 00:03:14.900
 is coming into this as

63
00:03:14.900 --> 00:03:17.300
 long as this source of the packet is

64
00:03:17.300 --> 00:03:20.100
 coming from this Security Group. So with this basically

65
00:03:20.100 --> 00:03:24.000
 does it says any virtual instances that are associated

66
00:03:23.100 --> 00:03:26.600
 with the security group. They could pass traffic

67
00:03:26.600 --> 00:03:29.400
 back and forth to each other so inbound traffic

68
00:03:29.400 --> 00:03:32.100
 can come to them from only within the security group.

69
00:03:33.400 --> 00:03:36.100
So let's go over and click over here. Before we go

70
00:03:36.100 --> 00:03:40.400
 look at outbound rules. If you needed to make any edits to

71
00:03:39.400 --> 00:03:42.100
 this any of the rules, you can go over here

72
00:03:42.100 --> 00:03:45.300
 and click the edit inbound rules as well as if

73
00:03:45.300 --> 00:03:48.600
 you were creating a new Security Group, you can use the orange

74
00:03:48.600 --> 00:03:51.400
 create button at the top like we have any other components and

75
00:03:51.400 --> 00:03:55.500
 then the delete or edit onto

76
00:03:54.500 --> 00:03:57.900
 the actions dropdown. Okay without the

77
00:03:57.900 --> 00:03:59.000
 way let's go back to outbound rules.

78
00:03:59.700 --> 00:04:02.400
So the outbound rules meaning any packet that

79
00:04:02.400 --> 00:04:05.300
 is leaving the security group heading somewhere else.

80
00:04:05.300 --> 00:04:08.300
 That's what these rules govern and as you can see here, the

81
00:04:08.300 --> 00:04:11.900
 rule is just like the inbound rules has the same attributes. You

82
00:04:11.900 --> 00:04:14.200
 need except this one. You can see that we

83
00:04:14.200 --> 00:04:17.600
 set ipv4 is in the IP version. This

84
00:04:17.600 --> 00:04:20.700
 is being explicit saying that any ipv4

85
00:04:20.700 --> 00:04:21.400
 packet.

86
00:04:22.100 --> 00:04:23.100
any type of traffic

87
00:04:24.200 --> 00:04:27.600
any protocol TCP UDP and any port range if

88
00:04:27.600 --> 00:04:30.300
 it's headed for our 0.0 / 0

89
00:04:30.300 --> 00:04:33.600
 destination, which is that catch all meaning

90
00:04:33.600 --> 00:04:34.700
 anywhere out in the internet.

91
00:04:35.400 --> 00:04:38.200
Will allow this rule allows this to happen if this

92
00:04:38.200 --> 00:04:41.600
 rule wasn't here then outbound would not happen. And so

93
00:04:41.600 --> 00:04:44.400
 if you were on your virtual instance, there was no outbound rule

94
00:04:44.400 --> 00:04:47.700
 for your Security Group. You would not be able to go out and let's

95
00:04:47.700 --> 00:04:50.100
 say run your package update on Lennox. So

96
00:04:50.100 --> 00:04:53.100
 if you're on Debian or Ubuntu you would run app get update it would not

97
00:04:53.100 --> 00:04:55.800
 work because your virtual instance would not be able to head out.

98
00:04:56.500 --> 00:04:59.600
All right. So there's a quick brief overview of

99
00:04:59.600 --> 00:05:02.900
 security groups in the AWS console. Obviously,

100
00:05:02.900 --> 00:05:05.600
 we're gonna create our own a little bit later, but I

101
00:05:05.600 --> 00:05:08.100
 wanted you to get a good view of it as when we

102
00:05:08.100 --> 00:05:11.900
 get to terraform files. We'll see some of where this comes into play. Okay

103
00:05:11.900 --> 00:05:14.500
 from here, let's jump over internet gateways

104
00:05:14.500 --> 00:05:17.400
 and it's if you go back over the left pain, you'll see internet gateways here.

105
00:05:17.400 --> 00:05:20.900
 Let's go ahead and click it and go to internet gateways and

106
00:05:20.900 --> 00:05:23.600
 this is gonna be probably the most plain

107
00:05:23.600 --> 00:05:24.700
 component. We're gonna look at

108
00:05:25.700 --> 00:05:28.800
Because it really isn't much going on here Amazon really

109
00:05:28.800 --> 00:05:31.400
 obvious skates, a lot of what's going on behind the

110
00:05:31.400 --> 00:05:34.200
 scenes. So there really isn't many options or many settings

111
00:05:34.200 --> 00:05:37.500
 we can play with here. So but if you look the internet gateway ID

112
00:05:37.500 --> 00:05:40.500
 igw Dash the characters just like

113
00:05:40.500 --> 00:05:43.200
 the other components we can see here. The state is

114
00:05:43.200 --> 00:05:46.400
 attached meaning that it's it's running on in

115
00:05:46.400 --> 00:05:49.400
 for this VPC and you can see the VPC ID, which

116
00:05:49.400 --> 00:05:52.500
 is the default VPC that Amazon created for us that's really

117
00:05:52.500 --> 00:05:55.800
 about it to talk about internet gateways except for

118
00:05:55.800 --> 00:05:58.400
 the main point is that you need an internet

119
00:05:58.400 --> 00:06:01.700
 gateway in your VPC. If you want your virtual instances

120
00:06:01.700 --> 00:06:04.800
 to be able to get out to the internet without

121
00:06:04.800 --> 00:06:07.500
 that they do not know how there's no route. There's

122
00:06:07.500 --> 00:06:10.600
 no way for them to get out to the Internet. So just

123
00:06:10.600 --> 00:06:13.800
 keep that in mind. If you ever do this without terraform you're

124
00:06:13.800 --> 00:06:16.200
 doing this by hand you obviously just like all the

125
00:06:16.200 --> 00:06:19.500
 components you have your create internet gateway button up

126
00:06:19.500 --> 00:06:22.500
 here. You also have the drop down where you can manage or

127
00:06:22.500 --> 00:06:25.600
 delete or detach this internet gate.

128
00:06:26.200 --> 00:06:29.400
All right, so that is going to be cover our brief overview

129
00:06:29.400 --> 00:06:32.400
 here in the AWS console for both the

130
00:06:32.400 --> 00:06:35.400
 security group in a Gateway. Let's go ahead and jump back in

131
00:06:35.400 --> 00:06:38.100
 the terminal and then let's go look at the terraform files that

132
00:06:38.100 --> 00:06:41.400
 make this up and we'll start to be able to piece together some of

133
00:06:41.400 --> 00:06:44.700
 these options you see in the console versus what we see in

134
00:06:44.700 --> 00:06:45.300
 the terraform file.

135
00:06:46.100 --> 00:06:50.200
Okay, so we're still in this lab terraform subdirectory.

136
00:06:50.800 --> 00:06:53.600
Of the cloned repository in the prerequisites. So

137
00:06:53.600 --> 00:06:56.600
 make sure that you obviously have that still we're

138
00:06:56.600 --> 00:07:00.700
 gonna open up our first file which is security underscoregroup.tf.

139
00:07:01.700 --> 00:07:04.700
And let's go inside. So as you can see this resource

140
00:07:04.700 --> 00:07:07.100
 from line two to line 33 is a lot larger than

141
00:07:07.100 --> 00:07:10.200
 the other resources that we've worked with so far and this is

142
00:07:10.200 --> 00:07:13.400
 because this multiple options for these inbound and outbound rules.

143
00:07:13.400 --> 00:07:17.600
 You can obviously have many rules to one one

144
00:07:16.600 --> 00:07:19.100
 Security Group and so here

145
00:07:19.100 --> 00:07:22.500
 we've got two inbound and one outbound

146
00:07:22.500 --> 00:07:24.300
 and we'll go over those in a second but

147
00:07:25.100 --> 00:07:28.500
Same resource declarations. You've seen in others except here.

148
00:07:28.500 --> 00:07:31.400
 Obviously, we're using the security group library to create a

149
00:07:31.400 --> 00:07:31.800
 security group.

150
00:07:32.700 --> 00:07:36.200
I called this resource allow SSH and HTTP.

151
00:07:35.200 --> 00:07:38.200
 No reason for that except I

152
00:07:38.200 --> 00:07:41.300
 wanted to be descriptive of what ports were actually opening up into

153
00:07:41.300 --> 00:07:42.000
 our instance.

154
00:07:42.700 --> 00:07:45.400
Same thing here with lines three and four just the name and description.

155
00:07:46.200 --> 00:07:49.400
As always we go to associate this network component with

156
00:07:49.400 --> 00:07:51.100
 the VPC. We want it to be in.

157
00:07:52.100 --> 00:07:55.600
Okay, so line 7 through 12 controls our egress or

158
00:07:55.600 --> 00:07:58.300
 this is our outbound and what the front

159
00:07:58.300 --> 00:08:01.400
 port and 2 Port online 89 do it basically

160
00:08:01.400 --> 00:08:04.600
 says whatever Port is coming from the packet

161
00:08:04.600 --> 00:08:06.100
 is originating from and what?

162
00:08:06.900 --> 00:08:08.900
Port the packet wants to go to

163
00:08:09.700 --> 00:08:13.100
with the zeros here. We're just saying we don't care any

164
00:08:12.100 --> 00:08:14.900
 port is okay for this rule.

165
00:08:15.600 --> 00:08:18.100
The problem line 10 the protocol which is

166
00:08:18.100 --> 00:08:19.100
 negative one means.

167
00:08:19.900 --> 00:08:22.100
All protocols TCP UDP, it doesn't

168
00:08:22.100 --> 00:08:22.300
 matter.

169
00:08:23.800 --> 00:08:26.000
and here again online 11, you see

170
00:08:26.200 --> 00:08:29.200
 the cider blocks and you see the string representation of the

171
00:08:29.200 --> 00:08:32.500
 0.0 / 0 that we've seen multiple times now, which

172
00:08:32.500 --> 00:08:32.900
 represents

173
00:08:33.700 --> 00:08:37.000
any address all addresses basically not

174
00:08:36.400 --> 00:08:39.700
 in the VPC. And so what this

175
00:08:39.700 --> 00:08:42.700
 egress rule basically says, like what we talked about in the

176
00:08:42.700 --> 00:08:44.500
 review in the console is that

177
00:08:45.500 --> 00:08:48.300
any packet destined on

178
00:08:48.300 --> 00:08:51.600
 one of the virtual service that's destined for out on the internet allow

179
00:08:51.600 --> 00:08:54.400
 that to happen. And you know, of course we want that's

180
00:08:54.400 --> 00:08:54.700
 a good thing.

181
00:08:55.200 --> 00:08:58.200
So let's talk about the two Ingress rules here

182
00:08:58.200 --> 00:09:01.500
 and Ingress means inbound. So right now

183
00:09:01.500 --> 00:09:04.200
 you can see lines 14 and through 20

184
00:09:04.200 --> 00:09:07.700
 and 22 to 20. They're very similar right except

185
00:09:07.700 --> 00:09:10.400
 for the descriptions and the front port and

186
00:09:10.400 --> 00:09:13.500
 2 Port so here in SSH because

187
00:09:13.500 --> 00:09:16.400
 we want to be able to SSH into our

188
00:09:16.400 --> 00:09:19.300
 virtual instance once we spin it up because in other

189
00:09:19.300 --> 00:09:22.200
 videos we're gonna actually run some do some tasks and talk about

190
00:09:22.200 --> 00:09:25.700
 Administration and other Cloud native stuff on

191
00:09:25.700 --> 00:09:28.300
 that host. So we need to be able to get into the host

192
00:09:28.300 --> 00:09:31.100
 and that's what this Ingress rule does.

193
00:09:31.100 --> 00:09:35.000
 It allows us to SSH into this host on

194
00:09:34.100 --> 00:09:37.400
 the TCP protocol since that is obviously what

195
00:09:37.400 --> 00:09:40.400
 SSH uses and line 19's. Probably

196
00:09:40.400 --> 00:09:43.500
 one quick note here. We're using the zero dot

197
00:09:43.500 --> 00:09:46.300
 zero slash zero string representation here of

198
00:09:46.300 --> 00:09:47.300
 any IP address.

199
00:09:48.200 --> 00:09:51.100
And that is okay for this demo or lab, but if you had something

200
00:09:51.100 --> 00:09:54.600
 more secure or time or sensitive you might want to put an

201
00:09:54.600 --> 00:09:57.200
 IP address in there that you know of and then that way that would

202
00:09:57.200 --> 00:10:00.400
 lock this down to say only allow an SSH connection

203
00:10:00.400 --> 00:10:03.700
 from a specific IP address to this VPC.

204
00:10:03.700 --> 00:10:06.500
 And so that's important to note. But obviously

205
00:10:06.500 --> 00:10:09.100
 like I said for this demo lab, we're completely fine.

206
00:10:10.100 --> 00:10:13.100
Okay, so the second Ingress rule what we're doing

207
00:10:13.100 --> 00:10:16.600
 here is the front port and two port instead of 22. We're

208
00:10:16.600 --> 00:10:19.200
 doing Port 80 and if you're familiar with Port 80,

209
00:10:19.200 --> 00:10:22.500
 it is the common HTTP port and this

210
00:10:22.500 --> 00:10:25.800
 will use this in a later section, but

211
00:10:25.800 --> 00:10:28.500
 I wanted to get it in here now, so we didn't have to go back and

212
00:10:28.500 --> 00:10:32.000
 do it. Once we had everything set up. Obviously HTTP

213
00:10:31.700 --> 00:10:34.600
 uses the TCP protocol and

214
00:10:34.600 --> 00:10:37.600
 here online 27 when we do the Zero from

215
00:10:37.600 --> 00:10:40.200
 any IP address, this is okay because we want anybody to

216
00:10:40.200 --> 00:10:43.700
 be able to hit this web service or whatever. That's what's

217
00:10:43.700 --> 00:10:45.500
 running on this other end on Port 80.

218
00:10:46.600 --> 00:10:49.200
The next thing we should get to is the tags and

219
00:10:49.200 --> 00:10:52.700
 the name as we always do we want to give them something memorable

220
00:10:52.700 --> 00:10:55.800
 and for us to remember be able to identify and

221
00:10:55.800 --> 00:10:58.600
 here we just do name and then we do the same thing that we

222
00:10:58.600 --> 00:11:02.200
 kind of did for the name in the description above that is

223
00:11:01.200 --> 00:11:05.400
 our security group. We can

224
00:11:05.400 --> 00:11:07.100
 go ahead and close this file and get out of it.

225
00:11:08.300 --> 00:11:10.600
So let's go ahead and look at the internet gateway.

226
00:11:11.700 --> 00:11:13.800
terraform file igw.tf

227
00:11:14.600 --> 00:11:17.200
and we'll open that up. And as you saw in the

228
00:11:17.200 --> 00:11:20.300
 idea was console. It's pretty bare. Like it was up there.

229
00:11:20.300 --> 00:11:23.300
 There's not many options here. The biggest thing it has

230
00:11:23.300 --> 00:11:26.000
 to be associated with the VPC and line three does that

231
00:11:26.300 --> 00:11:30.000
 for us? I named this just lab igw and

232
00:11:29.200 --> 00:11:33.200
 you can see we set our name tag as well. So all

233
00:11:32.200 --> 00:11:35.300
 right, we'll move on from this file as

234
00:11:35.300 --> 00:11:37.200
 well. Go ahead and close that now we're done here.

235
00:11:38.200 --> 00:11:41.400
Okay, so we're done with the looking at the terraform files for

236
00:11:41.400 --> 00:11:44.200
 for these two file for these two components. So let's go

237
00:11:44.200 --> 00:11:47.000
 back over and let's just do a recap of what we've done

238
00:11:47.300 --> 00:11:47.500
 so far.

239
00:11:48.400 --> 00:11:51.200
All right. So in this video you learned about

240
00:11:51.200 --> 00:11:54.500
 security groups and some of its features like being able to allow or

241
00:11:54.500 --> 00:11:56.400
 deny traffic to an ec2 instance.

242
00:11:57.100 --> 00:12:00.100
You also learned how internet gateways provide access to the internet.

243
00:12:01.100 --> 00:12:04.500
You also learned how internet gateways provide access to the internet and its

244
00:12:04.500 --> 00:12:06.000
 relationship within a VPC.

245
00:12:06.900 --> 00:12:09.300
Finally, we looked at both the terraform

246
00:12:09.300 --> 00:12:12.500
 files that would create your security group and your internet gateway for

247
00:12:12.500 --> 00:12:12.900
 your lab.

248
00:12:14.300 --> 00:12:17.600
in the next video, you will learn all about the final component in

249
00:12:17.600 --> 00:12:20.400
 our Cloud lab called elastic cloud computing or

250
00:12:21.200 --> 00:12:23.700
better known as ec2. Alright. See you soon.
