WEBVTT - This file was automatically generated by VIMEO

0
00:00:07.540 --> 00:00:08.100
In this video,

1
00:00:08.100 --> 00:00:11.640
you'll learn about some common AW S C L I commands that you can use to interact

2
00:00:11.640 --> 00:00:12.480
with aws.

3
00:00:14.130 --> 00:00:18.270
Our plan is to go over frequently used AWS C l I commands that replicated what

4
00:00:18.270 --> 00:00:21.230
you did in the web console. During the lab exercises,

5
00:00:21.630 --> 00:00:24.290
you'll run each command and learn about their use cases.

6
00:00:26.170 --> 00:00:27.030
So like I said,

7
00:00:27.060 --> 00:00:30.790
I've chosen 10 commands that replicate what you did in the AWS web console.

8
00:00:31.390 --> 00:00:34.670
I have thrown in a few xs for good measures so you can get some more exposure as

9
00:00:34.670 --> 00:00:35.503
well.

10
00:00:35.600 --> 00:00:39.060
I'm not gonna go over each of these 10 here as we're gonna explore them more in

11
00:00:39.060 --> 00:00:41.860
the terminal in a bit, but please take a,

12
00:00:41.940 --> 00:00:45.780
a second to pause the video and go ahead and look at each and understand, uh,

13
00:00:45.800 --> 00:00:48.660
get yourself a good idea of what we're gonna be going over. Okay,

14
00:00:48.750 --> 00:00:49.583
let's get started.

15
00:00:52.440 --> 00:00:55.980
We are going to go ahead and run these commands from our local host instead of

16
00:00:55.980 --> 00:00:59.580
the C two instance that we created earlier. And this is because if you remember,

17
00:00:59.580 --> 00:01:02.420
when we set up a lab, we set up the AWS command,

18
00:01:02.800 --> 00:01:05.420
our access key and secret key on our local host.

19
00:01:05.440 --> 00:01:08.300
And instead of duplicating that on the e c two instance, just easier,

20
00:01:08.300 --> 00:01:10.700
if we were run the commands from there, there's, there'll be no difference.

21
00:01:11.280 --> 00:01:14.230
So to go ahead. Okay,

22
00:01:14.410 --> 00:01:17.990
so I'm gonna go ahead and exit out of my SSA session. You can just type in exit,

23
00:01:17.990 --> 00:01:21.430
hit return. And here I am back in my local host.

24
00:01:21.910 --> 00:01:25.190
I am in the lab terraform sub directory.

25
00:01:25.730 --> 00:01:29.210
It doesn't matter which directory in to run these commands. Okay,

26
00:01:29.210 --> 00:01:31.250
so if you remember when we first set up our lab,

27
00:01:31.270 --> 00:01:35.330
we used Terraform to create our infrastructure and explore data and the AWS

28
00:01:35.330 --> 00:01:39.030
console, you could do all those things we did in the browser.

29
00:01:39.210 --> 00:01:43.910
And Terraform actually using just the S C L I. Like I said before,

30
00:01:43.980 --> 00:01:47.510
I've cherry picked some common commands that you can use to manage your AW s

31
00:01:47.670 --> 00:01:51.470
resources. So let's go ahead and look at the first command and we're gonna fetch

32
00:01:51.470 --> 00:01:55.790
information about BPC since that was the first major thing that we discussed and

33
00:01:55.790 --> 00:01:58.790
talked about when we were creating Terraform. Makes sense that we, we,

34
00:01:58.810 --> 00:02:00.110
we look at that here now.

35
00:02:00.570 --> 00:02:04.830
So we're gonna describe VPCs and so when we use the the describe VPCs command,

36
00:02:05.900 --> 00:02:06.140
um,

37
00:02:06.140 --> 00:02:09.720
you're gonna get all the VPCs in the account and then after that we'll learn how

38
00:02:09.720 --> 00:02:11.320
to filter down. Uh, one,

39
00:02:11.340 --> 00:02:13.680
one quick thing about all these AWS commands we're gonna run.

40
00:02:16.880 --> 00:02:21.250
They show the output in J S O N by default for us. Um,

41
00:02:21.440 --> 00:02:25.770
there's nothing wrong with the J S O output. Um, you can also do table, um,

42
00:02:25.770 --> 00:02:27.290
which will show it more of like a table view.

43
00:02:27.410 --> 00:02:30.450
I think the table view looks a little bit nicer on video here.

44
00:02:30.910 --> 00:02:33.330
So that's what we're gonna do. And so basically we're gonna, uh,

45
00:02:33.330 --> 00:02:38.090
append the dash dash output table flag to each of these commands.

46
00:02:38.110 --> 00:02:39.410
But I just wanted to let you know, let's,

47
00:02:39.430 --> 00:02:43.110
you could exclude the output table and just get json, okay,

48
00:02:43.170 --> 00:02:47.270
so we'll use the AWS command, we're gonna use EC two.

49
00:02:47.970 --> 00:02:49.550
And here's our output table.

50
00:02:54.080 --> 00:02:57.580
And we're gonna describe our VPCs. And like I said,

51
00:02:57.580 --> 00:03:02.050
this is gonna show us all the VPCs, which means there's obviously,

52
00:03:02.050 --> 00:03:02.650
there's two of 'em.

53
00:03:02.650 --> 00:03:04.850
There's the default one and then the lab VPC won't create it.

54
00:03:04.850 --> 00:03:08.180
So lemme hit return. And here we are,

55
00:03:08.200 --> 00:03:11.300
we have this nice table output. Um, and as you can see,

56
00:03:11.720 --> 00:03:14.580
it gives us the first VPC up here, which

57
00:03:16.610 --> 00:03:18.670
is the 10 0 0 slash 16,

58
00:03:19.120 --> 00:03:22.550
which we know that is our um, vpc.

59
00:03:23.460 --> 00:03:27.680
And you can see down here it has a name and that's the lab vpc.

60
00:03:28.020 --> 00:03:31.320
But then you can see we're in this less style, uh,

61
00:03:31.460 --> 00:03:34.480
output where you just have the colon and the blink and flasher.

62
00:03:34.480 --> 00:03:35.960
If I hit the space bar here,

63
00:03:36.680 --> 00:03:40.480
I can go all the way down to its final and then we hear end.

64
00:03:40.740 --> 00:03:44.240
And if we wanna get out here, we can hit q. The other sider block here,

65
00:03:44.240 --> 00:03:47.320
you could tell is our default VPC that was created for us when we created our

66
00:03:47.320 --> 00:03:51.140
account. So I can hit the up arrow and I can grow up,

67
00:03:51.280 --> 00:03:53.340
up and down using the arrows just like I couldn't less.

68
00:03:55.220 --> 00:03:58.920
And so there's both of them. So let me hit Q to get out of there.

69
00:04:00.840 --> 00:04:02.570
Okay, so now it's just filtered down.

70
00:04:02.570 --> 00:04:06.130
Let's say we wanna look for the specific thing. I'm gonna hit the up arrow,

71
00:04:06.700 --> 00:04:11.180
right? And then I'm gonna use the dash filters. The dash filters.

72
00:04:11.360 --> 00:04:15.620
SA uh, flag and filters takes a name and a value. And,

73
00:04:15.680 --> 00:04:19.940
and in our case, our name here right is gonna be the tag name.

74
00:04:20.280 --> 00:04:23.940
So this is a little bit confusing. Let me just type it out and you can see. So

75
00:04:25.980 --> 00:04:27.600
the tag, when we created the tags,

76
00:04:27.720 --> 00:04:31.880
remember we had a key value in the tag and the key was name as well

77
00:04:32.880 --> 00:04:36.580
and the value was the name, which in our case is live vpc. So here

78
00:04:38.740 --> 00:04:43.360
the filters needs a name in values and in our case it's gonna be lab

79
00:04:43.740 --> 00:04:45.800
vpc. So I'll um, as you can see,

80
00:04:45.800 --> 00:04:50.200
so we're filtering on the tag name and then the value we're looking for is lab

81
00:04:50.500 --> 00:04:54.630
vpc. So this should only give us the one VPC output. And here you go.

82
00:04:54.650 --> 00:04:56.670
As you can see, we don't have the extra long output.

83
00:04:56.700 --> 00:05:01.190
It's the one VPC that we created and we know it's R one cuz we can see down here

84
00:05:01.190 --> 00:05:04.700
is the tag and it's lab vpc. All right,

85
00:05:04.700 --> 00:05:08.430
let me hit Q to get out of there. Let me clear the screen.

86
00:05:09.670 --> 00:05:12.360
Okay, so we can continue going down the line.

87
00:05:12.660 --> 00:05:14.840
And let's look at our subnets.

88
00:05:15.380 --> 00:05:19.480
So EC two sub command and then we're gonna describe our subnets.

89
00:05:20.400 --> 00:05:23.490
I gotta spell describe first and

90
00:05:25.190 --> 00:05:26.740
let's do the output table.

91
00:05:29.340 --> 00:05:31.400
And so we should get all the subnets.

92
00:05:31.400 --> 00:05:33.400
Now there was quite a bit subnets if you recall.

93
00:05:33.500 --> 00:05:38.160
We only created one for our test lab. But as you, so here we are,

94
00:05:38.160 --> 00:05:40.330
here we have our subnets.

95
00:05:40.430 --> 00:05:45.330
The first one up here you can see is that it's in the US west two

96
00:05:45.490 --> 00:05:47.490
a availability zone. Um,

97
00:05:47.490 --> 00:05:50.650
it is the 10 0 1 0 slash 24,

98
00:05:50.740 --> 00:05:53.290
which happens to be our subnet that we created.

99
00:05:54.340 --> 00:05:58.160
And you can see the tag here is lab subnet public one.

100
00:05:59.100 --> 00:06:03.120
And if I hit the space bar, we'll page down, we'll get the next subnet.

101
00:06:03.900 --> 00:06:07.680
And as you can see here, we can just keep going down here.

102
00:06:08.550 --> 00:06:10.450
And as you can see, as we keep scrolling down,

103
00:06:11.620 --> 00:06:15.730
these are all the different subnets uh, that was created when we we signed up.

104
00:06:16.070 --> 00:06:19.730
So if we wanted to, you could use the same

105
00:06:21.440 --> 00:06:25.780
dash filters, you could use the,

106
00:06:25.920 --> 00:06:27.660
the same uh, thing we did with uh,

107
00:06:27.660 --> 00:06:32.420
the VPCs using the filters and then go on name and the lab subnet public one

108
00:06:32.680 --> 00:06:35.900
to grab that specific one. But I won't show that way again,

109
00:06:36.040 --> 00:06:38.940
you cuz we already just did it for the vpc. Let me clear the screen.

110
00:06:41.900 --> 00:06:45.830
Okay, the next command that we're gonna go look at is security groups.

111
00:06:46.050 --> 00:06:48.710
And to make this easy, I'm just gonna hit the up arrow.

112
00:06:49.970 --> 00:06:53.710
And this one is describe secure IT key

113
00:06:54.580 --> 00:06:58.640
groups. And as you can see, if you remember,

114
00:06:58.640 --> 00:07:03.240
we had multiple security groups, but it turns out in our, our table output here,

115
00:07:03.820 --> 00:07:06.160
if you recall the uh, the name the,

116
00:07:07.430 --> 00:07:11.490
the description of our secured group that we created was allow s ssh and H E B

117
00:07:11.490 --> 00:07:15.350
inbound traffic. And it has the front port, which is the 22.

118
00:07:15.890 --> 00:07:20.000
And you could see that. And then if we keep going down here, um,

119
00:07:20.000 --> 00:07:23.320
you also have the 80 front port TCP two port 80.

120
00:07:24.730 --> 00:07:27.470
And then here we are getting into another subgroup here is uh,

121
00:07:27.470 --> 00:07:31.590
this is the default VPC security subgroup, which is right here. We keep, uh,

122
00:07:31.670 --> 00:07:35.670
hitting the space bar attack go down so we reach the end. So um,

123
00:07:35.850 --> 00:07:39.470
we can hit Q to get out. And so that was viewing the security groups.

124
00:07:39.470 --> 00:07:44.390
And as you see we have all the key values that we saw in the content pain on

125
00:07:44.390 --> 00:07:48.970
the detailed pan up. We were in AWS web console. Uh, let me clear the screen.

126
00:07:49.960 --> 00:07:54.140
So the next thing we wanna move on to is if you remember when Terraform to

127
00:07:54.140 --> 00:07:55.020
create our key pair,

128
00:07:55.040 --> 00:07:57.580
we actually used a file to create a key pair and we use Terraform to copy that

129
00:07:57.580 --> 00:08:02.540
up so we could SSH onto our Amazon Lennox host because by default there's no

130
00:08:02.860 --> 00:08:06.220
password for the E C two user. It's only Keybase for security reasons.

131
00:08:06.930 --> 00:08:09.510
So one way you could do is if you needed to grab

132
00:08:12.400 --> 00:08:15.420
the key pair, the public key pair you, you created,

133
00:08:15.520 --> 00:08:17.460
you can actually see them all here.

134
00:08:17.480 --> 00:08:20.660
Not the actual keys of course itself because the uh, thing,

135
00:08:20.660 --> 00:08:24.940
but you can actually see the key pair ID where they're stored. So if we do this,

136
00:08:25.240 --> 00:08:27.260
and if you notice here, I didn't use the output table,

137
00:08:27.380 --> 00:08:29.500
I just wanted to show you what the J S O looked like one time.

138
00:08:29.640 --> 00:08:32.540
And this isn't a lot of output so this was a good one to show you json.

139
00:08:32.880 --> 00:08:35.260
But you could see here we have a key pair ID

140
00:08:36.790 --> 00:08:40.850
and you could use that if you were ever creating a new instance from the AW cli,

141
00:08:40.870 --> 00:08:45.040
you could use that key id. You have the name, whatever type it is,

142
00:08:45.040 --> 00:08:47.120
there's no tags on it. And then when it was created.

143
00:08:47.540 --> 00:08:50.680
So to get out of this JS o I'll put you Q

144
00:08:52.620 --> 00:08:55.560
Okay, so let's move on to our next set of, of commands.

145
00:08:55.560 --> 00:09:00.280
And these are all gonna be based on describe instances,

146
00:09:00.460 --> 00:09:01.440
our C two instances.

147
00:09:01.460 --> 00:09:04.120
And this is where we're gonna learn more about the help command for each of

148
00:09:04.120 --> 00:09:07.230
these commands. So AWS E C two

149
00:09:09.000 --> 00:09:13.800
describe instances and let me add my table output here and

150
00:09:24.800 --> 00:09:29.080
let me put my output table here and may make sure I spell everything correctly.

151
00:09:29.940 --> 00:09:31.440
And let's go ahead and run this command.

152
00:09:33.430 --> 00:09:37.130
So I've only created one instance here for those, for these courses.

153
00:09:37.790 --> 00:09:41.250
And so only one should show up. But here is our table output.

154
00:09:41.310 --> 00:09:44.990
You can see here is our instance ID and

155
00:09:46.530 --> 00:09:50.010
I'm gonna copy that into my buffer cause I'm gonna show you one way you could do

156
00:09:50.010 --> 00:09:53.850
this as well. So I'm just gonna copy the instance id,

157
00:09:54.070 --> 00:09:58.170
you can see that it is a T micro. We launched it with our key pier,

158
00:09:58.170 --> 00:09:59.003
which we just saw.

159
00:09:59.710 --> 00:10:04.210
And then you have the public IP address of this e c two host and also the

160
00:10:04.210 --> 00:10:07.890
private and all the C two instance metadata that we saw.

161
00:10:08.610 --> 00:10:11.460
This is all about the rest of the metadata that you see in that pain.

162
00:10:11.680 --> 00:10:14.340
You keep hitting the space bar to tap down, you'll get more and more.

163
00:10:14.340 --> 00:10:18.460
You can see the security group that it was attached to what association it has,

164
00:10:19.040 --> 00:10:23.730
uh, network interfaces and we've reached the end and obviously the tag and you

165
00:10:23.810 --> 00:10:27.210
remember this tag lab one and then environment, it was lab.

166
00:10:28.030 --> 00:10:31.630
So hit cue to get out of here. And so interestingly enough,

167
00:10:31.740 --> 00:10:35.990
each of the commands that you run, you can tag on help to the end.

168
00:10:36.650 --> 00:10:37.430
And what this will do,

169
00:10:37.430 --> 00:10:41.310
this will drop you into like it's a man page for that command.

170
00:10:42.350 --> 00:10:46.900
And so if I hit return, you can see here we get to the describe instances,

171
00:10:47.720 --> 00:10:47.960
uh,

172
00:10:47.960 --> 00:10:52.660
man page and it basically tells you it describes the specified instances for all

173
00:10:52.840 --> 00:10:53.700
or all instances.

174
00:10:53.800 --> 00:10:57.900
So you could do a specific one or all of them and we just did the all command.

175
00:10:58.480 --> 00:11:00.580
So let's figure out how to, uh,

176
00:11:01.280 --> 00:11:05.460
go through and just figure out how to grab just one specific instance.

177
00:11:05.460 --> 00:11:06.940
So if you hit the space bar again,

178
00:11:06.940 --> 00:11:10.580
it will page down and the first page down as you see,

179
00:11:11.160 --> 00:11:15.420
you can see here it has the dash dash instance IDs and it takes a value.

180
00:11:16.190 --> 00:11:17.570
So that is what we're gonna use.

181
00:11:17.570 --> 00:11:21.850
That's the flag we're gonna pass to this command to just get our specific

182
00:11:22.330 --> 00:11:24.250
instance id. Uh, if you come down here,

183
00:11:24.250 --> 00:11:27.130
it tells you what each of these different um, things are.

184
00:11:27.130 --> 00:11:31.170
If you can see here instance ID is the ID of the instance and it basically just

185
00:11:31.170 --> 00:11:33.170
gives you a thing and we could keep hitting space bar.

186
00:11:33.170 --> 00:11:37.170
There is tons of information in here. Also, there's a dry run,

187
00:11:37.580 --> 00:11:38.490
there is a,

188
00:11:38.700 --> 00:11:42.330
tells you about the J S O syntax output tells you about the paging size,

189
00:11:42.820 --> 00:11:46.050
tells you about the different output formats is JSON tech's table.

190
00:11:46.110 --> 00:11:49.690
And the amel obviously we've been using the table is debug option.

191
00:11:50.210 --> 00:11:52.690
I won't go through every single uh, option here in the major,

192
00:11:52.710 --> 00:11:56.920
but just just to know if you're unsure of what flags to pass the command or

193
00:11:56.920 --> 00:12:01.200
you're unsure about a command itself, the help here for AW C L I is fantastic.

194
00:12:01.700 --> 00:12:03.360
So all right, let's hit Q to get outta here.

195
00:12:04.770 --> 00:12:08.910
And so what we're gonna do is we're gonna use the dash dash instance IDs.

196
00:12:11.520 --> 00:12:11.810
Okay,

197
00:12:11.810 --> 00:12:16.240
lemme clear the screen here and we're gonna hit the up arrow just to make it

198
00:12:16.240 --> 00:12:17.480
easier. And then we're gonna do dash,

199
00:12:17.480 --> 00:12:22.440
dash instance IDs and then we're gonna paste in the instance id we took from the

200
00:12:22.600 --> 00:12:24.880
describe instance command we ran just earlier.

201
00:12:25.540 --> 00:12:29.200
And so now this should output just that instance. Id, uh,

202
00:12:29.200 --> 00:12:31.000
just that instance running now we've only got one running,

203
00:12:31.000 --> 00:12:33.400
so the output's not gonna really change, but you,

204
00:12:33.440 --> 00:12:36.600
I wanna show you that you can use different flags and use the help menu to

205
00:12:36.600 --> 00:12:40.990
figure out how to dwindle down your results. And as you see here,

206
00:12:41.170 --> 00:12:43.230
we go ahead and we get the same exact output.

207
00:12:43.350 --> 00:12:46.190
I won't go through it all cuz it's the exact same we saw earlier,

208
00:12:46.450 --> 00:12:49.990
but this time we showed that we only fetch the specific one.

209
00:12:53.910 --> 00:12:57.530
All right, so let me go ahead and clear the screen right here.

210
00:12:58.320 --> 00:13:01.220
And so we're gonna stick with the EC two instance ones, right?

211
00:13:02.300 --> 00:13:04.560
And if we do just the help command rate here,

212
00:13:05.300 --> 00:13:09.640
we can go ahead and instead we don't know the, uh, sub command we want to do.

213
00:13:10.430 --> 00:13:14.610
And now this gives us all the sub commands for e ec two part

214
00:13:15.230 --> 00:13:18.410
and just like we had, unless you could do slash and search for this,

215
00:13:18.630 --> 00:13:23.050
now we wanna run an instance, right? So we've, we've looked at 'em,

216
00:13:23.310 --> 00:13:26.290
the Terraform and a s console, remember you can create it through that,

217
00:13:26.550 --> 00:13:29.370
but you can run an instance from a s uh c L I as well.

218
00:13:29.370 --> 00:13:32.050
And so I'm gonna hit slash run and hit return.

219
00:13:32.710 --> 00:13:35.610
I'm gonna hit end to keep searching and as you can see,

220
00:13:35.610 --> 00:13:40.490
there's quite a bit until we get to run dash instances and that's exactly the

221
00:13:40.490 --> 00:13:44.350
one we want. So I need to learn more about that. I can hit the queue.

222
00:13:45.340 --> 00:13:49.540
And then what we wanna do is we want to go run instances help.

223
00:13:50.110 --> 00:13:53.050
And then now, now it should show us what we can do with the run instances.

224
00:13:54.050 --> 00:13:58.110
And here it says is launch a specified number of instances using an AMI for

225
00:13:58.110 --> 00:13:58.910
which you have permission.

226
00:13:58.910 --> 00:14:03.150
So this basically is gonna do everything Terraform did for us on create the EC

227
00:14:03.150 --> 00:14:07.110
two instance that you can use the launch instance button from the e c two web

228
00:14:07.110 --> 00:14:11.160
console. Now obviously launching an C two instance,

229
00:14:11.360 --> 00:14:15.040
there's so many different flags you could use. So I'm not gonna go into it.

230
00:14:15.090 --> 00:14:18.040
We're actually not gonna run this, this command. Um,

231
00:14:18.040 --> 00:14:19.880
and the reason being is because if something happens,

232
00:14:19.880 --> 00:14:21.160
you'll have another instance running.

233
00:14:21.560 --> 00:14:24.560
I don't want you to have to deal with any of those problems. So, but I am gonna,

234
00:14:24.630 --> 00:14:26.040
I'll pace the command to show what it looks like,

235
00:14:26.040 --> 00:14:28.160
but these are all the different flags that you can use.

236
00:14:28.380 --> 00:14:32.470
So I'm gonna quit outta here and then I'll go ahead and, um,

237
00:14:32.470 --> 00:14:34.990
through the screen and I'll go ahead and uh,

238
00:14:35.040 --> 00:14:38.430
paste what the command you would use to run the instance and then we can talk

239
00:14:38.430 --> 00:14:41.860
about it. All right, so there we go.

240
00:14:42.280 --> 00:14:46.760
So there is the a c two run instance command, as you see with the flags,

241
00:14:47.140 --> 00:14:50.200
it requires an image id and that is the,

242
00:14:50.200 --> 00:14:52.320
basically the AMI that we've used in our case.

243
00:14:52.480 --> 00:14:56.130
Remember we used Amazon Lennox two, we could see that we want to count of one,

244
00:14:56.130 --> 00:14:57.370
we only wanna spin up one of them.

245
00:14:57.790 --> 00:15:01.250
We select the instance type here it's the T2 micro, which is the free tier.

246
00:15:01.750 --> 00:15:04.490
And then here's the key name. And if you remember we used the key name,

247
00:15:04.490 --> 00:15:07.690
which was the lab key pair that we used, that we created for ourselves.

248
00:15:08.310 --> 00:15:13.170
We also see here that we set the security group IDs and you saw

249
00:15:13.170 --> 00:15:17.530
when we did the describe security groups command that there was the ID

250
00:15:18.210 --> 00:15:20.650
security group ID for us that we could, uh,

251
00:15:20.650 --> 00:15:24.250
substitute there or we could use these variables if we wanted to as well.

252
00:15:24.510 --> 00:15:27.930
You could see building a BA script out of this and setting these variables

253
00:15:28.300 --> 00:15:32.130
ahead. And then running these, uh, aw C L I commands after you, you, uh,

254
00:15:32.130 --> 00:15:33.130
create these variables.

255
00:15:33.430 --> 00:15:37.090
And then finally you need the subnet ID for what subnet you're putting it into.

256
00:15:37.270 --> 00:15:40.770
And this case would've been the, the one that we created. And we get the IDs,

257
00:15:40.770 --> 00:15:42.650
notice that we're using IDs here and not names.

258
00:15:43.030 --> 00:15:47.730
And and that's for specific reason and that's why you get those unique long, uh,

259
00:15:47.730 --> 00:15:51.410
characters of the IDs when we created stuff and when we reviewed them in the AWS

260
00:15:51.410 --> 00:15:55.950
web console. Okay, that was a lot. So I hope that makes sense to you.

261
00:15:56.250 --> 00:15:57.990
I'm gonna go ahead and control C outta this.

262
00:15:59.240 --> 00:16:01.700
If you wanted to terminate an instance, which is the,

263
00:16:01.700 --> 00:16:04.100
obviously the opposite of running it, you

264
00:16:06.250 --> 00:16:09.730
can use the terminate instances command. Make sure I spelled that right. It did.

265
00:16:10.270 --> 00:16:13.170
And then what you would use is you would use instance

266
00:16:14.770 --> 00:16:17.510
IDs again and then you would paste the ID

267
00:16:19.070 --> 00:16:21.570
of your instance ID that you wanted to terminate.

268
00:16:22.230 --> 00:16:25.530
So obviously we're not gonna terminate ours yet when obviously when the course

269
00:16:25.550 --> 00:16:28.490
is over, feel free to, to disable your whole account. Like I've,

270
00:16:28.490 --> 00:16:29.330
I've told you before,

271
00:16:29.710 --> 00:16:34.010
or you could go ahead and run the terraform destroy command,

272
00:16:34.590 --> 00:16:36.650
um, that we talked about also in the,

273
00:16:36.710 --> 00:16:40.370
the lab video where it'll take down all the stuff you've created and then that

274
00:16:40.370 --> 00:16:41.570
way you have an empty account.

275
00:16:41.570 --> 00:16:44.650
You don't have to worry about occurring any extra cost just in case.

276
00:16:45.230 --> 00:16:48.780
So I'm a control C outta here. That's how you terminate instances,

277
00:16:48.780 --> 00:16:52.290
that's how you run an instances, that's how you look for instances. Okay,

278
00:16:52.470 --> 00:16:57.070
so lemme clear the screen. The next command that we're gonna talk about is, uh,

279
00:16:57.070 --> 00:16:59.270
something that we didn't do actually in the web console,

280
00:16:59.410 --> 00:17:02.910
but I added this because I think it's important because in a real production

281
00:17:02.910 --> 00:17:06.470
environment we would've created users in groups along those lines.

282
00:17:06.650 --> 00:17:11.390
So we're gonna talk about using the IAM resource and

283
00:17:11.520 --> 00:17:14.750
we'll talk about creating and deleting and listing users.

284
00:17:14.890 --> 00:17:16.390
So the first thing we're gonna do is, well, let's,

285
00:17:16.390 --> 00:17:18.830
let's just list all the users that are on our account.

286
00:17:21.940 --> 00:17:26.110
And as you can see, I did the J S O output here. It's empty users,

287
00:17:26.330 --> 00:17:29.750
an empty array here. And that is because

288
00:17:31.520 --> 00:17:33.940
I'd never created a user. When we set this up a terraform,

289
00:17:33.940 --> 00:17:36.420
we were using the default user just for simplicity.

290
00:17:36.680 --> 00:17:40.810
So let me hit Q to get out of here. Okay, so what we're gonna do,

291
00:17:41.990 --> 00:17:45.170
and we're gonna use the, lemme do the output

292
00:17:47.300 --> 00:17:51.720
table here and we're gonna use the create user sub command.

293
00:17:52.610 --> 00:17:56.680
And the flag it takes is username.

294
00:17:56.900 --> 00:18:00.360
And I'm gonna just create a user called Bender. It's not that big a,

295
00:18:00.360 --> 00:18:02.880
you can name it whatever you want. Uh, we're only gonna create it,

296
00:18:02.880 --> 00:18:04.920
we're gonna delete it obviously right afterwards too,

297
00:18:04.920 --> 00:18:07.540
so you don't have any leftover users, but there you go.

298
00:18:08.240 --> 00:18:12.900
So I go ahead and hit return and it tells me it created a user,

299
00:18:12.900 --> 00:18:17.020
it gives me the id, tells me when it was created, and there's an arn,

300
00:18:17.020 --> 00:18:21.140
which we won't go into now, so oh that's great. So we hit Q to get outta here.

301
00:18:21.160 --> 00:18:21.993
So we have this user.

302
00:18:22.080 --> 00:18:24.740
So if I hit the up arrow with Weis to get the list users again,

303
00:18:25.320 --> 00:18:28.020
but this case I am going to

304
00:18:29.680 --> 00:18:31.660
use the dash dash output table.

305
00:18:34.980 --> 00:18:38.040
And you can see now when I list users, it has our vendor username.

306
00:18:38.060 --> 00:18:41.040
Now Bender doesn't have any policies or any kind of permissions or anything

307
00:18:41.040 --> 00:18:42.440
anyway, can't really do anything.

308
00:18:42.500 --> 00:18:46.640
But I wanna show you how easy it is to create a an IM user inside aws.

309
00:18:47.400 --> 00:18:51.370
So now what we're gonna do is I'm going to

310
00:18:52.100 --> 00:18:55.560
scroll up and instead of the create user, I'm gonna get rid of the create.

311
00:18:56.500 --> 00:18:58.480
And you see how he this, we're just gonna say delete user.

312
00:18:59.020 --> 00:19:02.040
So now we're actually gonna delete the vendor user and get rid of it.

313
00:19:02.800 --> 00:19:06.930
So I go ahead and hit enter here. We have no, uh,

314
00:19:06.990 --> 00:19:11.410
output back means that we're successful deleting it and to prove that it's gone,

315
00:19:11.470 --> 00:19:13.370
we can use the list users command,

316
00:19:13.370 --> 00:19:17.530
hit up arrow a few times to get the list users and you can run list users again.

317
00:19:17.990 --> 00:19:20.930
And as you see now we're in the table format. There is nothing there,

318
00:19:20.930 --> 00:19:24.940
it's just empty, but just the header. Okay, so we,

319
00:19:24.940 --> 00:19:27.140
we've covered some common AWS C L I command,

320
00:19:27.200 --> 00:19:29.900
so that iselle we're gonna discuss here in the terminal.

321
00:19:29.910 --> 00:19:34.150
Let's head back over and we'll do a full recap. Okay,

322
00:19:34.150 --> 00:19:35.710
so let's talk about what we did. In this video.

323
00:19:36.170 --> 00:19:40.150
You learned about 10 common AWS C I commands that you can use every day.

324
00:19:40.610 --> 00:19:44.350
You practice finding information about some of the commands using the built-in

325
00:19:44.350 --> 00:19:48.730
help. And finally, we executed each command and navigated the output. Now,

326
00:19:49.340 --> 00:19:52.450
while you can create the infrastructure with AWS C L I,

327
00:19:53.130 --> 00:19:56.690
I would hesitate and say that you should still stick with Terraform or the other

328
00:19:56.690 --> 00:19:59.290
infrastructure's code tooling, like we talked about earlier on,

329
00:19:59.830 --> 00:20:04.730
for making sure that you have item potency and that if there's any other issues

330
00:20:04.730 --> 00:20:07.010
like the AWS C L I changes,

331
00:20:07.190 --> 00:20:10.250
you don't run into issues there and you wanted to keep it consistent.

332
00:20:10.350 --> 00:20:13.850
But I wanted to show you that you can do all these things that we did in the web

333
00:20:13.850 --> 00:20:18.570
console and in Terraform using the fantastic AW S C L I that Amazon

334
00:20:18.570 --> 00:20:22.800
provides. This brings Section seven to a close.

335
00:20:23.340 --> 00:20:26.320
In this section you learned about some frequently used commands that you can use

336
00:20:26.340 --> 00:20:30.840
in your terminal to interact with Lennox and aws. In the next section,

337
00:20:31.050 --> 00:20:35.120
we'll wrap up this course with some best practices for the cloud and discuss

338
00:20:35.130 --> 00:20:38.280
where you can go next to keep on learning. See you soon.
