AWS EC2 AMI and EBS Backup and Restore Methods

Hands-On Lab

 

Photo of Trent Hayes

Trent Hayes

Training Architect

Length

00:30:00

Difficulty

Intermediate

Welcome to this live AWS learning activity for backing up and restoring EC2 instances. This activity will explore several common back-up and restore methods for the AWS EC2 service. By completing this activity, you will gain hands-on experience with: 1) EBS snapshots 2) Amazon Machine Images (AMIs) For administrators and operations personnel, it is extreamly important to understand the need for backing up application resources. These actions are one step you can take to ensure quick recovery from disasters, and/or to have the ability to roll back changes if necessary. 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.

AWS EC2 AMI and EBS Backup and Restore Methods

Introduction

Backups are very useful both for disaster recovery and for day-to-day application deployments that may not go as planned. In this lab, we're going to learn several ways to back up our data and machines in EC2. Specifically, we're going to:

  • Create a snapshot and use it to restore data
  • Create a custom AMI and use it to create a new instance
  • Create a snapshot and use it to create a custom AMI

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

Snapshots and AMI Backup and Restoration

Create an EBS Snapshot

The first thing we're going to do is create a snapshot from the EBS volume of a web application server.

  1. Navigate to the EC2 service, and choose Instances in the left sidebar.
  2. Check the box next to one of the webserver-instance instances to select it.
  3. In the Description tab at the bottom of the page, click the link next to Root device.
  4. In the popup that opens, click the EBS ID volume link.
  5. On the Volumes page, make sure the volume is selected. Then click Actions and Create Snapshot.
  6. For Description, type "wordpressSnap".
  7. Click Create Snapshot.
  8. Click Close to exit the success message.
  9. Select Snapshots in the left sidebar. You should see our wordpressSnap snapshot in the list.

Note: It may take a few minutes for the status of our snapshot to change from pending to completed.

Create a New EBS Volume from a Snapshot

Next, we're going to create a new EBS volume from the snapshot we just created.

  1. On the Snapshot page, make sure the wordpressSnap snapshot is selected.
  2. Click Actions, then Create Volume.
  3. Change Size (GiB) to "10".
  4. Click Create Volume.
  5. Click Close to exit the success message.
  6. Click Volumes in the left sidebar. You should now see 4 volumes in the list.
  7. Select the 10 GiB volume from the list by clicking the checkbox next to it.
  8. Click Actions then Attach Volume.
  9. Click into the Instance field, and select the webserver-instance option from the dropdown.
  10. Click Attach.

Create Two EC2 AMIs

Amazon Machine Images (AMIs) can be created using several different methods. We're going to walk through two different ways to do it.

Method 1

  1. On the Instances page, uncheck the box next to the webserver-instance we were working with in the previous step.
  2. Select the other webserver-instance in the list.
  3. Click Actions, then Image and Create Image.
  4. For Image name and Image description type "AMI1".
  5. Click Create Image, then Close.
  6. Choose AMIs from the left sidebar to see the image we just created.
  7. Once the status is available, choose Instances from the left sidebar.
  8. Click Launch Instance.
  9. Choose My AMIs in the left sidebar.
  10. Click Select, then Next: Configure Instance Details.
  11. Click Next: Add Storage, Next: Add Tags, then Next: Configure Security Group.
  12. Choose the Select an existing security group option. Then select the security group with wordpress-ec2 in the Description column.
  13. Click Review and Launch then Launch.
  14. In the popup that opens, select Proceed without a key pair from the dropdown menu, and check the box next to the acknowledgement.
  15. Click Launch Instances.

Method 2

  1. Select Snapshots from the left sidebar.
  2. Check the box beside the wordpressSnap snapshot we created earlier.
  3. Click Actions, then Create Image.
  4. For Name and Description, type "AMI2".
  5. Change Virtualization type to Hardware-assisted virtualization.
  6. Click Create.
  7. Click Close.
  8. Choose AMIs from the left sidebar to see the image we just created.

Conclusion

Congratulations, you've successfully completed this lab!