NET702: Lab 10 Working with EBS

Task 1: Creating an EBS Volume

Step 1: Open Vocareum -> Click on the lab -> My Work -> Start Lab. A pop-up window will appear and when it says, “Lab status: ready”, close the window -> Click on AWS tab on top right navigation bar.

Step 2: Click on “Service” -> Select “EC2” -> Click on “Instances” on the left navigation panel. We will see an instance name “Lab” is there by default for this lab. Check the availability zone of the instance and note it down -> Click on “Volumes” from the left navigation panel.

Step 3: Select “Create Volume” and enter the volume type as “General Purpose SSD (gp2)”, Size as “1”, availability zone as the one which the instance had -> Click on “Add Tag” and enter the key as “Name” and value as “My Volume” -> Click on “Create Volume” and select “Close”.

Task 2: Attaching volume to Instance

Step 1: Select “My Volume” -> Click on “Actions” and select “Attack Volume” -> Click on the “Instance” field and select the instance “Lab”. We can see that the “Device” field is set /dev/sdf. -> Click on “Attach”.

Task 3: Connecting to Amazon EC2 Instance

Step 1: Click on “Details” at the top navigation in the Vocareum lab. -> Click on “Show” -> Select the “Download PPK” button and save the file -> Click on “X” to close the window.

Step 2: Download “PuTTY” -> Open the putty.exe -> Configure PuTTY by clicking on “Connections” -> Select “Set Seconds between keepalives” to “30” to allow the session last longer.

Step 3: Click on “Session” on left navigation pane -> Under “Host Name (or IP address)” enter the IPv4 address of the EC2 instance.

Step 4: Go to “Connection” on left navigation panel -> Expand “+ SSH” -> Select “Auth” -> Click on “Browse” -> Select the file we downloaded from the Vocareum lab for this activity. -> Click on “Open” -> Press the button “Yes”.

Step 5: Enter the “login as” as “ec2-user”. This will connect PuTTY to EC2 instance.

Task 4: Creating and Configuring File System

Step 1: Paste “df -h” in PuTTY to view the storage of instance.

Step 2: Paste “sudo mkfs -t ext3 /dev/sdf” in PuTTY to create an ext3 file system in the volume.

Step 3: Paste “sudo mkdir /mnt/data-store” in PuTTY to create a directory for mounting new storage volume.

Step 4: Paste “sudo mount /dev/sdf /mnt/data-store” in PuTTY to mount the new drive.

Step 5: Paste “echo “/dev/sdf /mnt/data-store ext3 defaults,noatime 1 2” | sudo tee -a /etc/fstab” in PuTTY.

Step 6: Paste “cat /etc/fstab” in PuTTY to view the configuration file.

Step 7: To view the storage again, paste “df -h” in PuTTY.

Step 8: To create a file and add some text in the mounted volume, paste “sudo sh -c “echo some text has been written > /mnt/data-store/file.txt” in PuTTY.

Step 9: To check if the text is written in the volume, paste “cat /mnt/data-store/file.txt” in PuTTY.

Task 5: Creating an Amazon EBS Snapshot

Step 1: Click on AWS console -> Click on “Volumes” -> Select “My Volume” -> Click on “Actions” and select “Create Snapshot”.

Step 2: Click on “Add Tag” and enter the key as “Name” and the value as “My Snapshot” -> Click on “Create Snapshot” and click on “Close” button.

Step 3: Click on “Snapshots” on the left navigation panel and you can see the snapshot we have created.

Step 4: In the SSH session, delete the file created on the volume by pasting “sudo rm /mnt/data-store/file.txt” in PuTTY.

Step 5: Verify if the file is deleted or not by pasting “ls /mnt/data-store/” and we can see the result is “lost+found” which means the file is deleted.

Task 6: Restoring the Amazon EBS Snapshot

Step 1: Go to AWS console -> Select “My Snapshot” -> Click on “Actions” menu and select “Create Volume” -> Select the same availability zone used earlier -> Click on “Add Tag” and enter the key as “Name”, value as “Restored Volume” -> Click on “Create Volume” -> Click on “Close”.

Step 2: Click on “Volumes” -> Select “Restored Volume” -> Click on “Actions” menu and select “Attach Volume” -> Click on the “Instance” field and select “Lab”. -> Click on “Attach”.

Step 3: Go to PuTTY and paste “sudo mkdir /mnt/data-store2” to create directory for mounting the new storage volume.

Step 4: Enter “sudo mount /dev/sdg /mnt/data-store2” in PuTTY to mount the volume.

Step 5: Paste “ls /mnt/data-store2/” in PuTTY to confirm that the new volume that is mounted has the file that was created earlier. We can see in the result, the file name “file.txt” lost+found.

Reflection and Critical Thinking

In this lab, I have learned how to create an EBS volume, attach and mount the volume to EC2 instance, creating snapshots, making a new volume of snapshot and, attaching and mounting the new volume to the EC2 instance.

First, I created an EMS volume which need the storage size, availability zone, volume type. Then I created a tag for this volume which then I used to attach the volume to the EC2 Instance. After doing that I had to download a .ppk file from Vocareum and I also installed PuTTY so that I can connect to the EC2 Instance. When I opened PuTTY, I had to change few settings so that I can increase the time of a session and I had to go to SSH and in Auth, I had to browse the file I downloaded and opened it there.

A pop-up window appeared and logged into it. After that I had to enter few codes to check the storage of the instance that are available, created an ext3 file system, created a directory so I could mount the volume, and mounted the volume. Then I created a text file in the volume, and I went back to EBS console to create a Snapshot. After creating the snapshot, I went to PuTTY to delete the text file and I confirmed that was deleted.

In order to restore the file, I had to create a new volume from the snapshot and attached it to the EC2 instance. I went back to PuTTY and created the directory and mounted the volume. When I run the code to check if the file is available, the result showed that the volume had the file. Amazon EBS volumes are available to be used as a standard block device attached to an EC2 Instance. It offers durability to EC2 instances because the volumes are replicated into multiple availability zones and the users can use the snapshot feature which copies everything up to that point and gets stored in S3.  We can use these snapshots to create new volumes in case if anything gets deleted in the previous volume or it starts malfunctioning. This way it can protect the data for longer period. These snapshots can be accessed by other members who are users in AWS and are given the permission to access it. EBS has an annual failure rate of less than 1%, can have a storage capacity of up to 16 TB, and it is highly reliable because it in independent of EC2 instances.

Leave a comment

Design a site like this with WordPress.com
Get started