fbpx

How to Recover an EBS Volume from a Snapshot

How to Recover an EBS Volume from a Snapshot
This article will look at an EBS volume whose data is consistent at a particular point in time and explain how to recover an EBS Volume from a snapshot.
Share This Post

Amazon Elastic Block Store (Amazon EBS) offers highly available and persistent block-level storage with AWS EC2. This type of storage system is very useful when it comes to storing files, applications, and databases in order to achieve persistent data storage. EBS volumes can only be attached to EC2 instances that are located in the same Availability Zone (AZ).

While it is important to perform backups on a regular basis, certain cases, such as before any major changes are made within your company, call for backups when data is consistent at a stable point in time so it can be recovered in the future. AWS EBS provides you with the ability to create point-in-time consistent backup snapshots of volumes, we like to call them ‘crash-consistent’.

They are helpful when you want to restore data to a stable point in time when the crash-consistent snapshot was taken. This article will look at an EBS volume whose data is consistent at a particular point in time. You can back up data with crash-consistent snapshots, however it is important to note that AWS recommends stopping instances in order to achieve consistent data.

Otherwise, you can use solutions, such as N2WS Backup & Recovery, that provide application-consistent snapshots, ensuring data is consistent. Once a snapshot is taken, you can use it to recover files or volumes that were accidentally deleted by creating a new volume from that snapshot. AWS EBS snapshots provide incremental backups, therefore, if they are taken during different intervals of time, only the blocks that were modified would be backed up by AWS. This makes backups quicker and more cost effective. Below, we will outline how to recover files that were accidentally deleted from their EBS volume, using snapshots:

  1. We have launched a Windows 2012 based EC2 instance with an EBS volume as the root device. recover-an-ebs
  2. Data can be stored in a root or an additional volume that is attached to the instance. (Note: Two files—a text and an MP4—are stored in the EBS volume below.) recover-an-ebs
  3. You can now create a snapshot of this volume containing the data. recover-an-ebs Using CLI: (Note: For this example, we’ve assumed that the AWS CLI tool has already been installed on the local host.) aws ec2 create-snapshot –volume-id vol-654c7421 –description “This is my root volume backup snapshot.” recover-an-ebs Now, assuming that the two files stored on the volume were accidentally deleted, how can they be recovered? recover-an-ebs5 You can recover data using the snapshot you created in step #2.  The following steps detail this process:
  4. The snapshot that was generated through the volume can be seen in the following screen. recover-an-ebs6 Using CLI: aws ec2 describe-snapshots –snapshot-id snap-59c568d4 recover-an-ebs
  5. Create a volume of the snapshot (containing the data that is to be recovered) in the same AZ as the instance. recover-an-ebs8
  6. Next, fill the appropriate details (apart from the AZ) into the wizard below, such as the type and size of the volume, as well as IOPS (if you want to create a PIOPS volume). recover-an-ebs Using CLI: aws ec2 create-volume –region us-east-1 –availability-zone us-east-1a –snapshot-id snap-59c568d4 –volume-type io1 –iops 500 recover-an-ebs
  7. Check out the newly created volume in the following wizard. recover-an-ebs Using CLI: aws ec2 describe-volumes recover-an-ebs
  8. Next, attach this volume to the desired instance. recover-an-ebs Using CLI: aws ec2 attach-volume –volume-id vol-d63d0592 –instance-id i-ab669244 –device /dev/sdf recover-an-ebs We are attaching this volume as an additional volume to an already running instance in the US-East-1a region. You can configure additional devices as “D” drives on your Windows instance.
  9. “D” drives show the original data in the following wizard: recover-an-ebs15

There you have it. In this article, we have demonstrated how to recover lost data using EBS snapshots. It is recommended to perform backups at regular intervals. N2WS Backup & Recovery (CPM) is an enterprise-class backup, recovery and disaster recovery solution for EC2. It uses existing EBS volume and RDS database snapshot abilities to automatically take snapshots at regular intervals. Additionally, you can set up policies and schedule backups for various targets. CPM helps manage snapshots with policies. For example, if you have multiple snapshots, the older ones may be irrelevant. With CPM, you can configure a policy to delete the snapshots after a certain period.  This also helps in cost savings and effective backup management. Try N2WS Backup & Recovery (CPM) for FREE!

Read Also

Next step

The easier way to recover cloud workloads

Allowed us to save over $1 million in the management of AWS EBS snapshots...

Try N2WS for Free