Instructor: Okay, so let's have a play with EBS volumes.
And so if we click on our EC2 instance and go to storage,
as we can see, we have root device details,
which is /dev/xvda.
The root device type is EBS.
And then if you look at the block devices
that are attached to our instance,
we have one volume ID here,
that is an EBS volume of eight gigabytes.
So we can click on it,
and we're taken directly into the EBS console.
And if I remove this volume ID,
we can see all the EBS volume in our accounts
which is currently just one EBS volume.
So what I can do is that,
we can create our own EBS volume, to do so,
we can create the volume right here
and we can create a volume type of type gp2
but we have a lot of different options here,
but let's go with gp2 right now
because it is simple of size two gigabytes.
And I'm going to create in one availability zone,
that is the same of the one
where my EC2 instance has been created.
So we can check it out
by going to this column, availability zone, right here.
And it says us-east-2b.
So I have to change the AZ here to say, us-east-2b.
I will not enable encryption or add tags.
I will just click on create the volume.
So my volume is not created.
I can again, remove this filter
and now I have the two volumes.
So one is in use, and this is the root volume of my machine.
And the other one is a two gigabyte volume
that is currently available.
So what we can do now
is that we can right-click and attach this volume
into our EC-tance, EC2 instance,
because it is in the same availability zone
as our EBS volumes.
So if I attach it,
and now it is being attached
and we can refresh
and see that it will be very ready very soon.
If we go back into our EC2 instance
and we refresh the information right here,
we can see under storage that now we have two block devices.
We have one right here, which is eight gigabytes
which is the root volume.
And now one is /dev/sdf,
two gigabytes also attached on our instance.
Now, about how to use that, um,
that's a volume,
it's a little bit complicated
and takes a lot of time and out of scope
but there is a tutorial right here on the documentation.
If you type, "formats EBS volume to attach on EC2 instance",
something like that, yes, here we go.
This will show you how to do it from this tutorial.
And you can go to Google
or you can also go onto the docs of the AWS documentation.
But this is a little bit more complicated and out of scope.
So I just want to show you from the AWS perspective
how EBS volumes work in this lecture.
Okay, so we have attached our volume.
And so, now, if we can go into the volumes right here
and refresh it, yes, they are both in use,
we can create a new volume of size two gigabyte again
but this time in us-east-2a,
and create this volume right here.
And so if we do so, we have now three volumes,
including this one,
and this one we can right-click and attach this volume,
but as we can see, there's no matching instances
because the volume is linked to an availability zone.
And so, therefore, we would have to have an instance
in us-east-2a, but we don't have one right now.
We have one in us-east-2b.
So we cannot attach it.
So, I can right-click this volume
and delete the volume and gone.
So as you can see, the cloud is very powerful
because in five seconds I can request storage
and then delete it,
and then it's very, very amazing how fast it is, right?
Think how long it would take
if you had to actually do this
on premises in your own data center.
Okay. So this is gone.
Now we can see that,
we have two EBS volumes in use available.
Now let's do a little experiment.
This is the cloud.
So we're going to terminate our instance
and see what happens to our EBS volume.
So if we terminate this instance right here, as we can see,
we have two EBS volumes right now,
but this one,
if we look at it,
this is going to terminate on--
delete on termination. Okay.
And this is because when we created the instance.
So if we go into the instance right here,
when we did launch an instance,
and very quickly I'm just going to skip for the option.
We had an EBS volume of eight gigabytes
and we had ticked the delete on termination attributes.
So this is going to delete my EBS volume right here.
But this one
does not have the delete on termination attributes.
And so therefore, it will not be deleted.
So let's verify this by going into our EC2 instance
and then terminate instance right here.
Terminates.
And now it is terminating it.
So it is shutting down and then it will be gone.
And let's have a look at what happens to our EBS volumes.
I will refresh it.
And as you can see, now, the two volumes are available
but very quickly, one is gone.
And here we go.
The only volume we have left is the two gigabyte volume.
And that took about 10, 20 seconds.
So that's it for this lecture.
I hope you liked it.
And I will see you in the next lecture.