Skip to content

How do I restore an Amazon EBS volume that's attached to an Amazon EC2 instance from an EBS snapshot?

3 minute read
0

I want to restore an Amazon Elastic Block Store (Amazon EBS) volume that's attached to an Amazon Elastic Compute Cloud (Amazon EC2) instance from an Amazon EBS snapshot.

Resolution

To restore an EBS volume from an EBS snapshot, take one of the following actions.

Restore the EBS snapshot to an EBS volume

To restore data from an EBS snapshot, create a new EBS volume from the EBS snapshot. The new EBS volume has the data of the EBS snapshot from the time that the snapshot was first created.

Attach the EBS volume to an existing Amazon EC2 instance, mount the volume inside the EC2 instance, and then read or copy the data.

Restore the root volume of an EC2 instance from an EBS snapshot

You can't overwrite an existing EBS volume with an EBS snapshot. Instead, create a new EBS volume from the EBS snapshot. Then, replace the old root volume of the EC2 instance with the new EBS volume.

To replace the root volume of the EC2 instance, complete the following steps:

  1. Stop your EC2 instance.
  2. Detach the old root volume from your EC2 instance.
  3. Note the device name that the root volume uses, for example /dev/xvda.
  4. Use the same device name to attach the new root volume to your EC2 instance.
  5. Start your EC2 instance.

Or, to restore the instance's root volume to a specific snapshot that you created from the root volume, replace the root volume.

Note: Replacing the root volume doesn't change the elastic network interface or the private IP address of the instance. AWS Windows Amazon Machine Images (AMIs) configure the network adapter to use DHCP by default. DHCP assigns the private IP address from the network interface rather than from the volume. The private IP address changes only if you configure a static IP address in the operating system.

Create an AMI from an EBS snapshot, and then launch a new EC2 instance from the AMI

Note: The AMI becomes the root volume for your new EC2 instance.

To create an AMI from an EBS snapshot, complete the following steps:

  1. Open the Amazon EC2 console.
  2. In the navigation pane, under Elastic Block Store, choose Snapshots.
  3. Select the EBS snapshot.
  4. Choose Actions, and then choose Create image from snapshot.
  5. Enter a name for your image, and then choose the other required configurations.
  6. Choose Create image.

After you create the image, make sure that it's available. Then, launch a new EC2 instance that uses the EBS snapshot for the root volume.

AWS OFFICIALUpdated a month ago