How To Restore AWS EC2 instance from a snapshot

Amazon-Web-Services-logoI have been working with Hyper-V checkpoints for a while and have been really impressed with the speed at which I can revert my instances when something goes wrong with an update or install.

So I expected similar approach in AWS EC2 and found  that restoring from a snapshot AWS EC2 is definitely not as easy as just right-clicking in Hyper-V.

From the documentation provided by AWS the following restoring from a snapshot AWS EC2 manual were loomed

Step 1: Gather Information about the Snapshot to Restore

a. From the EC2 Dashboard, click on “Resources” on the middle pane, then click the “Snapshots” link.

b. In the Snapshot window, locate the snapshot to recover and note the “Snapshot ID” and “Size”.

Step 2: Create a New Volume to hold the Snapshot

a. From the left hand pane, expand “Elastic Block Store” then click on
Volumes“.

b. Choose “Create Volume” then in the “Snapshot ID” field, enter the ID
noted in Step #1 above, then select the same volume size, type and
availability zone as the snapshot you need to restore.

c. Once complete, click the “Create Volume” button on the bottom right side of the page.

Step 3: Remove the Problematic Volume from the Instance

a. In order to proceed to replace the volume, the Instance will need to be shut down.

When you stop/start your instance, the IP address WILL change.
Unfortunately, there is no way to avoid this within the EC2 container.

b. From the Management Console, Choose “Instances” then locate the problematic VM, right-click and choose “Instance State” then “Stop“.

c. Once the instance has shut down, note the “Instance ID” for future steps, then return to the “Volumes” window, highlight the current volume and note the mount point – This information is located in the “Attachment Information” for the volume at the bottom of the screen.

d. Once the mount point has been noted, right-click on the volume and choose “Detach Volume” to remove it.

Step 4: Attach the NEW Volume to the Instance

a. From the same window, highlight the new volume created in step #2 from the Volumes list, then right-click and choose “Attach Volume

b. In the “Attach Volume” window, type the “Instance ID” of the stopped instance from step #3 and add the mount point into the “Device” field, then click the “Attach” button.

Step 5: Restart the Instance

Once the old volume is deleted, and the new one has been attached in the same location, the instance can be re-started from the Instances window, by right clicking and choosing “Instance State“, then “Start“.

The above steps should restore your instance to a working state however as noted, unless the instance is running in a VPC with an Elastic IP address, the external IP of your instance will have changed. This will mean that if you have set up any monitoring, backups, SSH sessions or anything else which relies on the previous IP, they will all need to be changed.

Good luck!