1

00:00:03,140  -->  00:00:09,030
welcome back to back space Academy in
this lecture we'll explore using EBS or

2

00:00:09,030  -->  00:00:15,599
elastic block storage as a storage
option for Amazon ec2 we'll create an

3

00:00:15,599  -->  00:00:20,550
instance which will have an extra EBS
volume attached to it and then we're

4

00:00:20,550  -->  00:00:25,590
going to go into the Linux operating
system and mount that volume will then

5

00:00:25,590  -->  00:00:29,970
take a snapshot of that volume and use
that snapshot to create a copy of that

6

00:00:29,970  -->  00:00:38,460
EBS volume. Okay so from the ec2
management console we'll launch an

7

00:00:38,460  -->  00:00:44,280
instance and I'm going to just select
the Amazon Linux AMI. Now I'm just

8

00:00:44,280  -->  00:00:48,300
going to slow down here and explain a
few things so we can see here it's with

9

00:00:48,300  -->  00:00:54,480
our t2 micro for instance storage it
only has the option for EBS there's no

10

00:00:54,480  -->  00:01:01,620
option for attaching an instance store
to that so let me scroll down we can see

11

00:01:01,620  -->  00:01:06,840
that most of them don't until we get to
an m3 medium and we can see there an m3

12

00:01:06,840  -->  00:01:10,939
medium can have instant store storage
attached to it

13

00:01:10,939  -->  00:01:15,720
you may want to consider using instant
store storage if you've got a batch

14

00:01:15,720  -->  00:01:22,590
operation and you just want to a
device or storage device that is going

15

00:01:22,590  -->  00:01:27,630
to be used for storage of batch data
that is not going to need to be

16

00:01:27,630  -->  00:01:31,500
persisted afterwards so it can be lost
after you've finished with that

17

00:01:31,500  -->  00:01:35,070
batch operation and so that's the kind
of thing that you would use an instance

18

00:01:35,070  -->  00:01:40,259
store for but it's normally with larger
instances I'm not going to go into

19

00:01:40,259  -->  00:01:43,920
instance store it's pretty well the same sort
of process that you would do with an EBS

20

00:01:43,920  -->  00:01:48,119
volume but I just don't want you to get
a bill at the end of the month if you

21

00:01:48,119  -->  00:01:52,170
forget to terminate all this stuff if
you forget to terminate a t2 micro

22

00:01:52,170  -->  00:01:55,710
instance it's not a major deal for you
financially but if you get a bigger

23

00:01:55,710  -->  00:01:58,619
instance it you might be a bit surprised
when you get your bill at the end of the

24

00:01:58,619  -->  00:02:05,100
month so I'm going to stick with a t2
micro and be responsible for you next

25

00:02:05,100  -->  00:02:09,149
configure instance details we want to
make sure that we have a public IP Auto

26

00:02:09,149  -->  00:02:13,270
automatically assigned for that we'll
leave everything else as it is

27

00:02:13,270  -->  00:02:19,910
add storage so we can see that as as we
normally have we have our root storage

28

00:02:19,910  -->  00:02:26,330
there which is has a storage name of dev
or device name of dev /xvda

29

00:02:26,330  -->  00:02:32,950
and the snapshot which would come
from our our Linux AMI

30

00:02:32,950  -->  00:02:38,209
and we can see there that we've selected
the general-purpose now we're going to

31

00:02:38,209  -->  00:02:42,890
add a new volume additional to that and
if we look at the selection there we've

32

00:02:42,890  -->  00:02:47,989
only got the option of EBS but if this
was a large instance then we would have

33

00:02:47,989  -->  00:02:53,630
an option of EBS or instance store type
storage the device name that has been

34

00:02:53,630  -->  00:03:00,110
selected for us there is dev /sdb but we
can change that if we want if we're going

35

00:03:00,110  -->  00:03:04,070
to be attaching multiple volumes they
will have different device names and we

36

00:03:04,070  -->  00:03:07,670
would need to take note of the device
names so that we can recognize and when

37

00:03:07,670  -->  00:03:14,450
we go to mount them we also have the
option of of creating this EBS volume

38

00:03:14,450  -->  00:03:19,400
from an EBS snapshot and we could select
that we don't have one so we're not

39

00:03:19,400  -->  00:03:24,920
going to do that and we have our volume
type so here it's automatically selected

40

00:03:24,920  -->  00:03:29,090
as a general purpose type but we could
do provisioned IOPS if we want and we can

41

00:03:29,090  -->  00:03:34,250
put our IOPS that we would like to
provision for this drive we could also

42

00:03:34,250  -->  00:03:39,079
go down to magnetic if we wanted to save
costs and if speed was not a major deal

43

00:03:39,079  -->  00:03:44,690
for us I'm going to stick with a general
purpose now I'd like you to take very

44

00:03:44,690  -->  00:03:52,430
good note here is that by default delete
on termination has been selected for the

45

00:03:52,430  -->  00:03:59,450
route volume but by default manually
added EBS volumes are not deleted on

46

00:03:59,450  -->  00:04:05,739
termination you need to you need to
remember that so that by default route

47

00:04:05,739  -->  00:04:11,780
are deleted on termination but by
default manually added EBS volumes are

48

00:04:11,780  -->  00:04:17,120
not but of course you can change that
here if you'd like the reason why

49

00:04:17,120  -->  00:04:21,019
manually added EBS volumes are not
normally deleted on termination is that

50

00:04:21,019  -->  00:04:24,680
they normally contain data and you
something goes wrong with your ec2

51

00:04:24,680  -->  00:04:27,500
instance
it is terminated you don't necessarily

52

00:04:27,500  -->  00:04:31,970
want to lose that data you want that data to
persist afterwards and use it maybe

53

00:04:31,970  -->  00:04:36,470
later on with another instance but for
this lab or for this hands-on exercise

54

00:04:36,470  -->  00:04:39,860
I'm going to select delete on
determination for both of them because I

55

00:04:39,860  -->  00:04:43,040
want to make sure that when you
terminate this instance everything is

56

00:04:43,040  -->  00:04:46,160
cleaned up afterwards and you're not
going to get a bill at the end of the

57

00:04:46,160  -->  00:04:53,060
month so just click on review and launch
and launch and I'll just select the key

58

00:04:53,060  -->  00:05:04,280
pair that I've used before and launch
that instance and after a certain amount

59

00:05:04,280  -->  00:05:08,360
of time we're going to have our instance
up and running if we look at the

60

00:05:08,360  -->  00:05:13,910
description of our instance when we
scroll down to block devices we can see

61

00:05:13,910  -->  00:05:19,280
that we've got our route device of xvda
 and also our manually added EBS

62

00:05:19,280  -->  00:05:23,900
volume which is at sdb so let's click
on that it'll give us the details of

63

00:05:23,900  -->  00:05:29,479
this so we can see that we've got an EBS volume ID there and it is attached and

64

00:05:29,479  -->  00:05:34,820
it has delete on termination selected
for true now although it has been

65

00:05:34,820  -->  00:05:39,830
attached it's not necessarily available
for us to use with that instance until

66

00:05:39,830  -->  00:05:43,580
we mount it so we're going to go now
into the command line interface and

67

00:05:43,580  -->  00:05:47,750
we're going to connect into this
instance and we're going to mount it

68

00:05:47,750  -->  00:05:54,050
using the Linux operating system
okay so I've just connected into that

69

00:05:54,050  -->  00:05:59,600
ec2 instance now the first thing we want
to do is just to list the block volumes

70

00:05:59,600  -->  00:06:07,400
that are attached to this instance so
just do a LS or list blk and that will

71

00:06:07,400  -->  00:06:13,150
list our volumes in so we can see we
have our route volume is xvda and

72

00:06:13,150  -->  00:06:19,460
that is mounted as a route volume there
it has a mount point there and we also

73

00:06:19,460  -->  00:06:25,430
see that there is xvdb which is our
manually added EBS volume and there is

74

00:06:25,430  -->  00:06:29,840
no mount point for that some we need to
create a mount point the first thing

75

00:06:29,840  -->  00:06:34,340
we'll do is we'll have a look and see
whether or not a filesystem is actually

76

00:06:34,340  -->  00:06:39,320
on that disk so the command we use there
is sudo

77

00:06:39,320  -->  00:06:45,170
for root we'll need root access to do
that sudo file -s and the name

78

00:06:45,170  -->  00:06:52,970
of our our EBS volume device now all the
details of this are in the AWS

79

00:06:52,970  -->  00:06:57,350
documentation so you get lost just refer
to that and it'll be pretty

80

00:06:57,350  -->  00:07:02,300
straightforward for you and then we can
see it's come back with data which means

81

00:07:02,300  -->  00:07:07,940
that there is no file system that has
been created on this volume so we need

82

00:07:07,940  -->  00:07:14,980
to do that now the command that we use
to create a file system is sudo mkfs and

83

00:07:14,980  -->  00:07:21,410
then we have the - T option and the
filesystem type and then we have the

84

00:07:21,410  -->  00:07:30,160
device name after that and there you can
see it's created that filesystem for us

85

00:07:30,160  -->  00:07:35,540
now to check whether or not we've
successfully created at filesystem we

86

00:07:35,540  -->  00:07:40,760
can just check the file systems now so
we can sudo file - s and then the name

87

00:07:40,760  -->  00:07:44,510
of that volume and it will tell us
whether there is a filesystem on there

88

00:07:44,510  -->  00:07:51,380
so there is a filesystem there we've got
the ID of that filesystem as well so now

89

00:07:51,380  -->  00:07:57,440
I'm just going to make a directory that
we can use as a mount point for this EBS

90

00:07:57,440  -->  00:08:04,310
volume so we just make a directory
called data and now we'll mount our EBS

91

00:08:04,310  -->  00:08:14,360
volume to that mount point directory so
now that we've mounted our volume we

92

00:08:14,360  -->  00:08:19,850
need to make sure that is mounted when
the instance reboots so to do that we

93

00:08:19,850  -->  00:08:24,980
need to edit our fstab file now if you
don't understand what all this means

94

00:08:24,980  -->  00:08:31,430
don't worry too much because this is not
a course on the Linux operating system

95

00:08:31,430  -->  00:08:37,370
it's a course on AWS so you just need to
know how to go through this process of

96

00:08:37,370  -->  00:08:41,630
mounting a volume you don't need to be
an expert in the Linux operating system

97

00:08:41,630  -->  00:08:47,210
but it is a good thing if you're going
to be using Linux in the future to learn

98

00:08:47,210  -->  00:08:51,800
a bit more about it so what we're going
to do now is just edit, but first of

99

00:08:51,800  -->  00:08:59,240
all we'll make a back
of our fstab file, so before I edit the

100

00:08:59,240  -->  00:09:05,690
file I need to get the ID of the EBS
volume I can use the device name but it

101

00:09:05,690  -->  00:09:10,490
is more reliable to use the ID of the
device so I'll just do that same command

102

00:09:10,490  -->  00:09:14,270
that we used before to get the file
system information and then I can see is

103

00:09:14,270  -->  00:09:16,600
that the ID there so it's going to copy
that

104

00:09:16,600  -->  00:09:23,650
UUID equals it's going to copy
that

105

00:09:23,650  -->  00:09:32,030
and now I'm going to edit that file the
fstab file in Nano so just sudo nano

106

00:09:32,030  -->  00:09:38,690
and then these file and there we can get
into the edited screen so you can see

107

00:09:38,690  -->  00:09:41,870
there's a number of entries and we need
to add another one for our our new

108

00:09:41,870  -->  00:09:47,870
amount so we just scroll down to the
bottom of the lift set and we're just

109

00:09:47,870  -->  00:09:52,520
going to put another entry and it's
going to paste it in so what we what

110

00:09:52,520  -->  00:09:56,720
we're going to put in is we're going to
put in the ID of that volume that we got

111

00:09:56,720  -->  00:10:01,870
from that command previously then we're
going to put in the mount point

112

00:10:01,870  -->  00:10:08,030
directory which is data or forward slash
data then the filesystem type and then

113

00:10:08,030  -->  00:10:13,850
we're going to do defaults and then
,nofail and then we're

114

00:10:13,850  -->  00:10:23,660
going to do 0 and 2 and once we've done
it that will enable that the EDS volume

115

00:10:23,660  -->  00:10:29,450
will be mounted upon reboot so just do
control X and if you want to save that

116

00:10:29,450  -->  00:10:35,420
we just click on yes we do want to save
that and enter and so now we can just

117

00:10:35,420  -->  00:10:39,680
check that it works so we do 
sudo mount -a and there's no errors

118

00:10:39,680  -->  00:10:44,180
coming back so that's fine instead we're
just going to CD into that data

119

00:10:44,180  -->  00:10:49,910
mount point directory which is where our
EBS volume is now mounted let me just

120

00:10:49,910  -->  00:10:57,380
do a dir on that and we can see there's
nothing in them and so now we'll just

121

00:10:57,380  -->  00:11:01,970
create a test folder so just to sudo
touch just create an empty file there of

122

00:11:01,970  -->  00:11:07,449
test.txt and i'll just dir into
that now

123

00:11:07,449  -->  00:11:14,660
okay so we've successfully create an ec2
instance with an additional EBS volume

124

00:11:14,660  -->  00:11:19,459
we've mounted that volume using a Linux
operating system we've added a file to

125

00:11:19,459  -->  00:11:24,350
that volume what I'd like to do now is
to create a snapshot snapshot of that

126

00:11:24,350  -->  00:11:33,170
volume and then use that snapshot to
launch another ec2 instance with a EBS

127

00:11:33,170  -->  00:11:38,720
volume that will be an exact replica of
that EBS volume that we created a

128

00:11:38,720  -->  00:11:45,980
snapshot from okay so back in the ec2
management console if I select the

129

00:11:45,980  -->  00:11:51,589
description of that ec2 instance and we
scroll down to the EBS volume that we've

130

00:11:51,589  -->  00:11:56,779
attached there dev /sdb and if I click
on that and if I click then on the EBS

131

00:11:56,779  -->  00:12:04,490
ID I can get the details of that EDS
volume which we've got there so what I

132

00:12:04,490  -->  00:12:08,300
want to do now is to create a snapshot
of this volume so I'll just go into

133

00:12:08,300  -->  00:12:14,540
actions create snapshot I'll give it a
name so I'll just give it a name

134

00:12:14,540  -->  00:12:22,690
backspace - and in the details of the
the volume just click on create now and

135

00:12:22,690  -->  00:12:32,899
it has started and so we can view this
snapshot now so just click on View now

136

00:12:32,899  -->  00:12:36,920
after a certain amount of time it will
be available for us to use so there is

137

00:12:36,920  -->  00:12:42,680
our completed snapshot so we just go to
actions and we can create a volume from

138

00:12:42,680  -->  00:12:48,230
this snapshot so I'm just going to leave
those the same as they are there and

139

00:12:48,230  -->  00:12:56,079
we'll create a volume for this snapshot
and we can do the volume there and

140

00:12:56,079  -->  00:13:02,480
there's our volume ready to go so now
jumping back into the ec2 management

141

00:13:02,480  -->  00:13:07,970
console I'm going to launch another
instance of the same type using the same

142

00:13:07,970  -->  00:13:16,160
ami but I'm going to use the snapshot
that we just created to attach a volume

143

00:13:16,160  -->  00:13:20,050
from or an identical volume for
the one that we just created a snapshot

144

00:13:20,050  -->  00:13:25,570
of so just going to launch instance will
select the same linux ami that we've

145

00:13:25,570  -->  00:13:31,060
selected before will you select the same
t2 micro that we had will again put a

146

00:13:31,060  -->  00:13:37,630
public IP during the lead storage now so
now we can add a new volume EBS and we

147

00:13:37,630  -->  00:13:43,210
can put the same device name there and
now we just got a search for our

148

00:13:43,210  -->  00:13:48,670
snapshot we just type in because I know
it started with backspace and

149

00:13:48,670  -->  00:13:52,810
it will come up with that snapshot there
so it's always a good idea to put a

150

00:13:52,810  -->  00:13:55,900
description in so as you can find your
snapshots a lot easier but I didn't put

151

00:13:55,900  -->  00:13:59,650
a description in but I know that that
was the snapshot it was any one that I

152

00:13:59,650  -->  00:14:04,510
created and I just do delete on
termination again so what we will be

153

00:14:04,510  -->  00:14:08,950
doing is we'll be creating as before a
Linux instance with an EBS volume

154

00:14:08,950  -->  00:14:13,750
attached but this time it will already
have a filel system created on it from a

155

00:14:13,750  -->  00:14:19,540
snapshot so we just need to mount that
volume afterwards and we'll have that

156

00:14:19,540  -->  00:14:26,260
ready to use so just going to review and
launch and launch using a key pair that

157

00:14:26,260  -->  00:14:28,680
we've used before

158

00:14:34,780  -->  00:14:40,700
okay so after a while our instance will
be up and running and so we can have a

159

00:14:40,700  -->  00:14:49,640
look at that now and we can see there
that we have our extra block devices as

160

00:14:49,640  -->  00:14:55,460
well so we've gone through with we've
done the two ways we've created a EBS

161

00:14:55,460  -->  00:15:02,030
volume from scratch on launch and we've
mounted that and we've added files to it

162

00:15:02,030  -->  00:15:07,190
and we've also gone the other way of
doing it with a snapshot as well so it

163

00:15:07,190  -->  00:15:11,450
got a pretty good understanding now of
EBS volumes and I'll see you in the next lecture
