View
994
Download
3
Category
Preview:
Citation preview
How To Create EBS Snapshot and Restore EBS Snapshot – Linux Instance
i | P a g e
Table of Contents
Overview ....................................................................................................................................................... 1
Applies To ...................................................................................................................................................... 1
Pre-requisites ................................................................................................................................................ 1
Create Snapshot ............................................................................................................................................ 1
Create Snapshot – Instance ...................................................................................................................... 1
Create Snapshot – Instance ID .................................................................................................................. 2
Create Snapshot – Volume ....................................................................................................................... 2
Create Snapshot – Create Snapshot ......................................................................................................... 2
Create Snapshot – Volume ID ................................................................................................................... 3
Create Snapshot – Name .......................................................................................................................... 3
Create Snapshot – Snapshot ID ................................................................................................................. 4
Create Snapshot – Status .......................................................................................................................... 4
Install – HTTPD Service .................................................................................................................................. 4
HTTPD – Check Installation ....................................................................................................................... 4
HTTPD – Install .......................................................................................................................................... 4
HTTPD – Verify Install ................................................................................................................................ 5
HTTPD – Modify Startup State .................................................................................................................. 5
HTTPD – Startup Service ........................................................................................................................... 5
Restore Snapshot .......................................................................................................................................... 6
Restore Snapshot – Create Volume .......................................................................................................... 6
Restore Snapshot – Availability Zone........................................................................................................ 6
Restore Snapshot – Create Volume .......................................................................................................... 7
Restore Snapshot – State .......................................................................................................................... 7
Restore Snapshot – Stop ........................................................................................................................... 7
Restore Snapshot – Instance State (stopping) .......................................................................................... 8
Restore Snapshot – Instance State (stopped) ........................................................................................... 8
Restore Snapshot – Detach Volume ......................................................................................................... 8
Restore Snapshot – Detach Volume (Confirm) ......................................................................................... 9
Restore Snapshot – Detach Volume (status) ............................................................................................ 9
Restore Snapshot – Attach Volume .......................................................................................................... 9
How To Create EBS Snapshot and Restore EBS Snapshot – Linux Instance
ii | P a g e
Restore Snapshot – Instance ID .............................................................................................................. 10
Restore Snapshot – Device ..................................................................................................................... 10
Restore Snapshot – Attachment Information ......................................................................................... 10
Restore Snapshot – Start Instance .......................................................................................................... 11
Restore Snapshot – Start Instance (confirm) .......................................................................................... 11
Restore Snapshot – Instance State (pending) ......................................................................................... 12
Restore Snapshot – Instance State (running) ......................................................................................... 12
Restore Snapshot – Instance State (status checks) ................................................................................ 12
Restore Snapshot – Validate Restore ..................................................................................................... 12
Troubleshooting .......................................................................................................................................... 13
Volume Detach........................................................................................................................................ 13
Volume Detach (error) ............................................................................................................................ 13
How To Create EBS Snapshot and Restore EBS Snapshot – Linux Instance
Page 1 of 15
Overview
One of the important features in AWS is to create EBS snapshot and restore the EBS volume to a host. Online snapshot of the Linux instance. The purpose is to rollback the changes at OS level. This guide will assist you in restoring the old snapshot and attach it to the existing server.
To test the Amazon EBS create snapshot and restore snapshot feature, we would install “httpd” service, set startup of httpd service on and start it on the new EBS volume and subsequently when we restore it “httpd” should NOT be installed on the server.
Applies To
Linux Instance, in this document we are considering RHEL 7.0
Pre-requisites
Field Information Purpose
Instance ID Required to identify the snapshot
Snapshot ID To collect volume and snapshot information
Availability Zone Availability of volume(s) in a zone
Volume Attachment Information Identify / associate device mount point
Volume State Available or In-use
Create Snapshot
The purpose of the snapshot is to do in-point-restore.
Create Snapshot – Instance
Choose the instance from the “Instances” link.
How To Create EBS Snapshot and Restore EBS Snapshot – Linux Instance
Page 2 of 15
Create Snapshot – Instance ID
Click on the instance and Make note of “Instance ID” and “Availability Zone” of the host for which snapshot will be taken.
Create Snapshot – Volume
Choose the Volumes from the “Elastic Block Store” link.
Create Snapshot – Create Snapshot
From the Actions dropdown; click on “Create Snapshot” to take snapshot of the volume.
How To Create EBS Snapshot and Restore EBS Snapshot – Linux Instance
Page 3 of 15
Create Snapshot – Volume ID
Upon clicking create snapshot, volume information is displayed for the tag name.
Create Snapshot – Name
Add “Name” and “Description” for the snapshot and click on “Create” button, to start snapshot of the volume.
How To Create EBS Snapshot and Restore EBS Snapshot – Linux Instance
Page 4 of 15
Create Snapshot – Snapshot ID
Upon clicking “Create” snapshot creation task is initiated with the “snapshot ID” associated to it. You can also click on “Snapshot ID” to check the status of the snapshot creation.
Create Snapshot – Status
In the Snapshot window, once the snapshot creation task is done, status will be updated to “Completed” and progress is updated to “available (100%)”.
Install – HTTPD Service
To test restore feature, we would be installing httpd service.
HTTPD – Check Installation
To verify if the httpd service is installed, run the below command
sudo rpm -qa | grep httpd
HTTPD – Install
To install httpd service without confirmation, run the below command
sudo yum install httpd -y
How To Create EBS Snapshot and Restore EBS Snapshot – Linux Instance
Page 5 of 15
HTTPD – Verify Install
To verify if the httpd service is installed, run the below command
sudo rpm -qa | grep httpd
HTTPD – Modify Startup State
To change httpd service state, run the below command
sudo chkconfig httpd on
HTTPD – Startup Service
To change httpd service state and validate service is running, run the below commands
sudo service httpd start
sudo service httpd status
How To Create EBS Snapshot and Restore EBS Snapshot – Linux Instance
Page 6 of 15
Restore Snapshot
In order to restore an existing snapshot, you need to keep in make note of availability zone and snapshot ID, which is required to associate with the host.
Restore Snapshot – Create Volume
In order to restore a snapshot, we need to convert the snapshot to a volume, choose the snapshot and click on “Create Volume” from the Actions dropdown.
Restore Snapshot – Availability Zone
Upon click on the Create Volume, the next step is to choose the “Availability Zone” for the new volume and click on “Create” button.
How To Create EBS Snapshot and Restore EBS Snapshot – Linux Instance
Page 7 of 15
Restore Snapshot – Create Volume
Upon clicking “Create” a volume creation task is initiated with the “Volume ID” associated to it. You can also click on “View Volume” to check the status of the Volume creation.
Restore Snapshot – State
Upon clicking “Volume ID” volume creation task state is displayed.
Restore Snapshot – Stop
Next step is to “Stop” the server instance from the instances pane. To stop the instance, from the Actions drop down, click on “Instance State Stop” option.
How To Create EBS Snapshot and Restore EBS Snapshot – Linux Instance
Page 8 of 15
Restore Snapshot – Instance State (stopping)
Upon click on Stop” for the server instance from the instances pane. “Instance State” is updated.
Restore Snapshot – Instance State (stopped)
Upon click on Stop” for the server instance from the instances pane. “Instance State” is updated, once it is completed, state is update with “Stopped”.
Restore Snapshot – Detach Volume
Next step is to detach the existing volume of the server, to detach choose the volume from the Actions dropdown, click on “Detach Volume” option.
How To Create EBS Snapshot and Restore EBS Snapshot – Linux Instance
Page 9 of 15
Restore Snapshot – Detach Volume (Confirm)
Next step is to detach the existing volume of the server, to detach choose the volume from the Actions dropdown, click on “Detach Volume” option.
Restore Snapshot – Detach Volume (status)
Detachment of the volume is updated in “Attachment Information”.
Restore Snapshot – Attach Volume
Once the detachment task is completed, the volume state is “available” and “Attachment Information” is not populated. Next step is to attach the old (snapshot) volume. Now, you can attach the old volume to the system, as part of rollback activity.
How To Create EBS Snapshot and Restore EBS Snapshot – Linux Instance
Page 10 of 15
Restore Snapshot – Instance ID
Upon clicking the “Attach Volume”, volume ID and availability zone of the volume is populated, click on Instance to choose the instance ID of the server.
Restore Snapshot – Device
After choosing the “Instance ID”, enter the device mount point for the volume.
Restore Snapshot – Attachment Information
Upon click on “Attach”, the new snapshot volume is attached to the server.
How To Create EBS Snapshot and Restore EBS Snapshot – Linux Instance
Page 11 of 15
Restore Snapshot – Start Instance
Once the state is updated to “in-use” and attachment information is suffixed with “(attached)”. The system is restored back old state. Now start the instance that was stopped earlier.
Restore Snapshot – Start Instance (confirm)
Upon clicking the “Start” option. Confirm the by clicking “Yes, Start” button to start the instance.
How To Create EBS Snapshot and Restore EBS Snapshot – Linux Instance
Page 12 of 15
Restore Snapshot – Instance State (pending)
Upon clicking the “Yes, Start” button, Instance state is validated and subsequently “Status Check” is validated.
Restore Snapshot – Instance State (running)
Upon successful validation, the instance is started and set to “running” and “Status Checks” are done.
Restore Snapshot – Instance State (status checks)
Upon successful validation of volume status and availability zone. “Status Checks” are set to green.
Restore Snapshot – Validate Restore
After login into the server, check the restore is successful, by querying httpd package installation status.
We had installed on the new volume, httpd service.
Upon restoration; httpd service is not installed.
How To Create EBS Snapshot and Restore EBS Snapshot – Linux Instance
Page 13 of 15
Troubleshooting
Volume Detach
In order to attach a new EBS volume, you need to attach existing root volume.
Volume Detach (error)
In this case when you try to detach a running instance volume it would throw the screenshot error. To mitigate the error stop the running instance, detach the volume.
Recommended