Updated: Jul 29, 2021
Persists EBS volume beyond the life of an EC2 instance, take snapshot & restore the EBS volume in a different region. Attach the restored EBS volume to a new EC2 instance in that region.
Learn to persist EBS Volume beyond the life of an EC2 instance.
Learn to replicate EBS Volume in different region and attach the same to new instance in that region. This will serve as your Disaster Recovery strategy.
Step 1: Create a Linux Instance as follows:
Click on Instances option in left navigation pane so as to be directed to following page. Click on Launch Instance button on top left.
After clicking on the launch instance you will be redirected to this page. Here search/select Amazon Linux 2 AMI.
Choose an Instance Type over here.
Select General purpose type t2.micro Instance Type.
Click on Next: Configure Instance Details at the bottom right of the screen.
Here you will Configure Instance Details.
In the Subnet field select on the drop down list and select any one of the Subnets. It is ap-south-1a in our case.
Note This subnet for reference afterwards.
In the Auto-assign Public IP field select on the drop down list and select Enable option.
Click Next: Add Storage at bottom right of screen.
Step 2: In the step for Add Storage, click on the Add New Volume. Let everything be default. Mention the required size of volume in GB. 50 GB in our case
Click on Next: Add Tags button in the down right corner.
Click on the Next: Configure Security Group at the bottom right of the screen.
Configure Security Group
Create a new security group and name it as LinuxSG
In the description enter the following text: Security Groups for Linux Servers
Keep the default SSH rule.
Warning: Rules with source of 0.0.0.0/0 allow all IP addresses to access your instance. We recommend setting security group rules to allow access from known IP addresses only.
While using this feature for production make sure the known IP address is entered.
Click on Review and Launch button on the bottom right corner
Review Instance Launch
Here are all the details regarding your instance. Read them once and check if all the configurations are correct
Click on the Launch button at the bottom right corner. This will launch your instance.
After you click the Launch button here you will be asked to select/create KEY-PAIR. Choose an existing key pair option from the drop down.
Acknowledge the key pair and launch the instance.
Click View Instance button at bottom right of the screen to see your launched instance.
Check if the instance is running.
Step 3: In the left panel of the AWS console go into Volumes under Elastic Block Store. Here you will see our 2 volumes created (One which was added by default with the instance and the other we added extra)
Name these two volumes as ROOT and DATA below the name category by clicking the pencil icon in the name column.
Step 4: Select the DATA volume. Go to Actions and click on Create Snapshot option.
Give details of the snapshot in the Create Snapshot pop-up window and click on Create Snapshot.
Step 5: Go to Snapshots under Elastic Block Store. Select your Snapshot.
Click on Actions -> Copy. Choose a different region and click on Copy.
Step 6: Now go to the different region as given below. Here the selection is Singapore in our case.
Step 7: Check that the snapshot has been copied to this region.
Go to Snapshots under Elastic Block Store. Go to Actions -> Create Volume.
We choose the same subnet in which the new Instance in this region is created.
Click on Create Volume.
Step 8: In the same Volume Tab, we observe that the DATA2 volume is in available state and the root volume of new server is in in-use state.
Step 9: Create a Linux Instance in this region. Refer to Step 1 and Step 2 in this document. Do not create an additional volume. This instance will have the default root volume only.
Step 10: Go to Volumes. Select the DATA volume. Go to Action -> Attach Volume.
In the pop up window select your newly created instance in the Instance text field. Click on Attach button.
Thus the volume restored in a new region through copying snapshot, is now attached to an instance in that region successfully.
This new instance in new region can serve as your disaster recovery strategy.
Note: If you no longer need this instance and the volume make sure to terminate the instance and delete the volume as well as snapshots.
Was this document helpful? How can we make this document better. Please provide your insights. You can download PDF version for reference.