03_SR_ICC_22CS142_LAB_EXPTS_3_AWS
03_SR_ICC_22CS142_LAB_EXPTS_3_AWS
Lab Experiment– 3
Lab Overview
This lab focuses on Amazon Elastic Block Store (Amazon EBS), a key underlying storage
mechanism for Amazon EC2 instances. In this lab, you will learn how to create an Amazon
EBS volume, attach it to an instance, apply a file system to the volume, and then take a
snapshot backup.
Topics covered
By the end of this lab, you will be able to:
Tip: To refresh the session length at any time, choose Start Lab again before
the timer reaches 0:00.
o Before you continue, wait until the circle icon to the right of the AWS link in
the upper-left corner turns green.
2. To connect to the AWS Management Console, choose the AWS link in the upper-left
corner.
o A new browser tab opens and connects you to the console.
Tip: If a new browser tab does not open, a banner or icon is usually at the top
of your browser with the message that your browser is preventing the site from
opening pop-up windows. Choose the banner or icon, and then choose Allow
pop-ups.
3. Arrange the AWS Management Console tab so that it displays along side these
instructions. Ideally, you will be able to see both browser tabs at the same time, to
make it easier to follow the lab steps.
At the end of this lab you will be instructed to submit the lab to receive a score based on your
progress.
Tip: The script that checks you works may only award points if you name resources and set
configurations as specified. In particular, values in these instructions that appear in This
Format should be entered exactly as documented (case-sensitive).
In this task, you will create and attach an Amazon EBS volume to a new Amazon EC2
instance.
4. In the AWS Management Console, in the search box next to Services , search for and
select EC2.
5. In the left navigation pane, choose Instances.
An Amazon EC2 instance named Lab has already been launched for your lab.
6. Note the Availability Zone of the instance. It will look similar to us-east-1a.
7. In the left navigation pane, choose Volumes.
You will see an existing volume that is being used by the Amazon EC2 instance. This
volume has a size of 8 GiB, which makes it easy to distinguish from the volume you
will create next, which will be 1 GiB in size.
Your new volume will appear in the list, and will move from the Creating state to the
Available state. You may need to choose refresh to see your new volume.
In this task you will attach the new EBS volume to the Amazon EC2 instance.
Note that the Device name is set to /dev/sdf. Notice also the message displayed that
"Newer Linux kernels may rename your devices to /dev/xvdf through /dev/xvdp
internally, even when the device name entered here (and shown in the details) is
/dev/sdf through /dev/sdp."
In this task, you will connect to the EC2 instance using EC2 Instance Connect which provides
access to a terminal in the browser.
14. In the AWS Management Console, in the search box next to Services , search for and
select EC2.
15. Choose Instances.
16. Select the Lab instance, and then choose Connect.
17. On the EC2 Instance Connect tab, choose Connect.
In this task, you will add the new volume to a Linux instance as an ext3 file system under the
/mnt/data-store mount point.
df -h
You should see output similar to:
The output shows that the original 8GB /dev/xvda1 disk volume mounted at / which
indicates that it is the root volume. It hosts the Linux operating system of the EC2
instance.
The 1GB other volume that you attached to the Lab instance is not listed, because you
have not yet created a file system on it or mounted the disk. Those actions are
necessary so that Linux operating system can make use of the new storage space. You
will take those actions next.
The output should indicate that a new file system was created on the attached volume.
To configure the Linux instance to mount this volume whenever the instance is
started, you will need to add a line to /etc/fstab. Run the command below to
accomplish that:
22. View the configuration file to see the setting on the last line:
cat /etc/fstab
df -h
Notice the last line. The output now lists /dev/xvdf which is the new mounted volume.
24. On your mounted volume, create a file and add some text to it.
25. Verify that the text has been written to your volume.
cat /mnt/data-store/file.txt
Leave the EC2 Instance Connect session running. You will return to it later in this lab.
Your snapshot is displayed. The status will first have a state of Pending, which means
that the snapshot is being created. It will then change to a state of Completed.
Note: Only used storage blocks are copied to snapshots, so empty blocks do not
occupy any snapshot storage space.
30. In your EC2 Instance Connect session, delete the file that you created on your
volume.
sudo rm /mnt/data-store/file.txt
ls /mnt/data-store/
If you ever wish to retrieve data stored in a snapshot, you can Restore the snapshot to a new
EBS volume.
Note: When restoring a snapshot to a new volume, you can also modify the
configuration, such as changing the volume type, size or Availability Zone.
Note that the Device field is set to /dev/sdg. You will use this device identifier in a
later task.
43. Verify that volume you mounted has the file that you created earlier.
ls /mnt/data-store2/
44. To record your progress, choose Submit at the top of these instructions.
45. When prompted, choose Yes.
After a couple of minutes, the grades panel appears and shows you how many points
you earned for each task. If the results don't display after a couple of minutes, choose
Grades at the top of these instructions.
Tip: You can submit your work multiple times. After you change your work, choose
Submit again. Your last submission is recorded for this lab.
46. To find detailed feedback about your work, choose Submission Report.
Tip: For any checks where you did not receive full points, there are sometimes
helpful details provided in the submission report.