Open In App

How To Restore EC2 From Snapshot?

Last Updated : 22 Jan, 2024
Improve
Improve
Like Article
Like
Save
Share
Report

AWS EC2 service is one of the most widely used services which allows users to rent virtual servers commonly called EC2 instances, to run applications and workloads. EC2 instances are customizable, and scalable and provide flexibility to choose different instance types based on computing requirements. EC2 plays a central role in the cloud computing landscape. It is always a good practice to keep a backup for the EC2 instance, because if by any chance EC2 instance is deleted or stops working then you can restore all the data and configuration lost from the backup. Having a backup is one of the best practices for safeguarding the data, ensuring business continuity, or recovering from any disaster.

Now you have learned why backup is important, so let me go through the steps to recover EC2 from the snapshot.

Steps To Restore EC2 From Snapshot

Step 1: Create an EC2 instance. Follow the below video to create an EC2 instance.

Step 2: Now connect the EC2 instance. Then create some random files inside the instance for the verification of restoration.

Use this command to create some random files. This command will create 10 files.

touch abc{1..10}

create-random-files

Step 3 : Now go to the Snapshots (you can find Snapshots in the left navigation pane of EC2 dashboard) and create a Snapshot for EC2 instance .

create-snapshot

Step 4 : After creating Snapshot wait until the Snapshot is available. Then go to EC2 dashboard and terminate the EC2 instance previously created .

terminate-ec2

Step 5 : Then go to Snapshots , and in the top right corner you will find actions , click Create image from snapshot from it . Give the snapshot a name and let all the other options in default .

create-image

Step 6 : You can check whether the image is created or not by checking the AMIs .

AMI-image-check

Step 7 : In the AMIs top right corner select launch instance from AMI .

Step 8 : Then connect the EC2 instance. Here you have to write a couple of commands to locate the files . (copy the commands one by one )

sudo su
cd ..
cd home/ubuntu
ls

see-the-files

You can see all the 10 files previously created . Now you have completed all the steps to restore the EC2 from the Snapshot .

Conclusion

You have learned why backups are important for EC2 instance . You have also successfully completed all the steps on how to restore the EC2 from a Snapshot .

Restore EC2 From Snapshot- FAQs

What is an EC2 Snapshot ?

EC2 Snapshot is a copy of the entire EC2 instance including its EBS volume , data and configuration at a particular point in time .

What do you mean by AMI ?

AMI stands for Amazon Machine Image . It is a pre-configured virtual machine image that is used to create EC2 instances .

How can you verify the restoration of EC2 instance ?

Before creating Snapshot for EC2 instance , create some random files inside the EC2 instance . After the new instance is created from the Snapshot then you can see files created before, inside the new instance .

Will the new instance created from Snapshot affected after the deletion of the original EC2 instance ?

The answer is no . Because Snapshot copied all the data and configuration of the original instance before it is deleted .

What are the different resource type for which Snapshot can be created in AWS ?

Snapshot can be created for both instance and volume resource types .



Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads