Resizing Root AWS EBS Volumes to Increase Performance

Hands-On Lab

 

Photo of Trent Hayes

Trent Hayes

Training Architect

Length

00:30:00

Difficulty

Intermediate

Welcome to this live AWS learning activity where you will be changing the size of root EBS volumes on EC2 instances. This activity provides hands-on experience resizing volumes in: 1) Standalone instances (a bastion host) 2) Auto scaling groups (two web server instances) There are different reasons for a system administrator to have to resize a root volume. Needing larger storage capacity is the most obvious, but resizing is also necessary to increase the base IOPS of a volume. In this case, the volume may not be running low on storage space. Good luck and enjoy the Learning Activity!

What are Hands-On Labs?

Hands-On Labs are scenario-based learning environments where learners can practice without consequences. Don't compromise a system or waste money on expensive downloads. Practice real-world skills without the real-world risk, no assembly required.

Resizing Root AWS EBS Volumes to Increase Performance

Introduction

There are several reasons a systems administrator might need to resize a root volume. Needing larger storage capacity is the most obvious, but resizing is also necessary for increasing the base IOPS of a volume.

In this lab, we're going to learn how to resize EBS root volumes on EC2 instances.

Specifically, we're going to get hands-on experience resizing volumes in:

  • Standalone instances (a bastion host)
  • Auto scaling groups (two web server instances)

Log in to the AWS console using the credentials provided on the lab instructions page.

Resizing Root EBS Volumes

Create an EBS Snapshot

  1. Navigate to the EC2 service, and click the 3 Running Instances link at the top of the page.
  2. Select bastion-host from the list.
  3. In the Description tab at the bottom of the page, scroll down and locate Root device.
  4. Click the link next to it, then click the EBS ID link.
  5. Click Actions and Create Snapshot.
  6. For Description, type "BastionSnap".
  7. Then click Create Snapshot.
  8. Close out of the success message.

Create a New (Larger) EBS Volume

  1. Click Snapshots in the left sidebar.
  2. When the status of our snapshot changes from pending to complete, click Actions and Create Volume.
  3. For the Size (GiB), type "40". (The IOPS should now be 100/3000.)
  4. Make sure the Availability Zone is set to us-east-1a.
  5. Click Create Volume, and close out of the success message.

Attach the Larger EBS Volume to an EC2 Instance

The next step is to replace the existing root EBS volume that is attached to an EC2 instance with the new, larger EBS volume that we just created.

  1. Click Instances in the left sidebar.
  2. Select the bastion-host instance.
  3. Click Actions, Instance State, and Stop.
  4. Click Yes, Stop.
  5. Click Volumes in the left sidebar.
  6. Select the 8-GiB volume associated with the bastion host.
  7. Click Actions then Detach Volume.
  8. Click Yes, Detach, then click the refresh icon at the top right of the screen.
  9. Deselect the 8-GiB volume, and select the 40-GiB volume.
  10. Click Actions then Attach Volume.
  11. For Instance, select the stopped bastion-host option from the dropdown. For Device, type "/dev/xvda".
  12. Click Attach.
  13. Click Instances in the left sidebar.
  14. Select the bastion-host instance by clicking the checkbox on the left.
  15. Click Actions, Instance State, then Start.
  16. In the Description tab, locate the public IP address, and copy it to your clipboard.
  17. Open your terminal application, and run the following command:
    ssh cloud_user@PUBLIC_IP_ADDRESS
  18. Type yes at the prompt.
  19. Enter the password from the lab instructions page.
  20. Next, list the block devices.
    lsblk
  21. Then close the connection to the instance.
    exit
  22. Go back to the AWS console in your browser.

Create a New Auto-Scaling Launch Configuration and Update the Existing Auto-Scaling Group

The next step is to create a new auto-scaling launch configuration that uses the new (larger) EBS volume for created instances. Then, we'll update the existing auto-scaling group to use the new launch configuration.

  1. Click Launch Configurations in the left sidebar.
  2. In the Details tab at the bottom of the page, click View User data. Copy this text to your clipboard.
  3. Click Create launch configuration.
  4. Select the Amazon Linux AMI.
  5. Leave t2.micro selected, and click Next: Configure details.
  6. For Name, type "newLC".
  7. Click the arrow next to Advanced Details, and paste the text we just copied into the User data field.
  8. Change IP Address Type to Do not assign a public IP address to every instance.
  9. Click Next: Add storage.
  10. Change Size (GiB) to "40".
  11. Click Next: Configure Security Group.
  12. For Assign a security group, choose Select an existing security group.
  13. Select the WebServerSecurityGroup from the list.
  14. Click Review and Create launch configuration.
  15. Choose Proceed without a key pair, and check the box next to the acknowledgement.
  16. Click Create launch configuration, then Close.
  17. Click Auto Scaling Groups in the left sidebar.
  18. Click Edit on the right side of the Details tab.
  19. Change the Launch Configuration to newLC.
  20. Click Save.
  21. Click Instances in the left sidebar.
  22. Select one of the webserver-instance instances in the list (either us-east-1a or us-east-1b).
  23. Click Actions, Instance State, and Terminate. Then click Yes, Terminate.
  24. Once the new instance that Auto Scaling has created is in the running state, select it.
  25. In the Description tab, click the Root device (/dev/xvda) and then click the EBS ID link.
  26. Repeat these steps with the other webserver-instance in the Instances list.

Conclusion

Congratulations, you've successfully completed this lab!