Over the last few years, cloud hosting has emerged to be one of the most preferred ways of hosting. There are a number of companies which have started to migrate their data to cloud servers working on command line interfaces. Also, when we talk about new age cloud hosting companies, Amazon AWS stands out for various reasons.
A lot of webmasters, who try to migrate from managed hosting to hostings like AWS, find it so difficult to manage the routine tasks. Creating a backup is also one of the routine tasks and a lot of people find themselves unable to do the same. A backup comes to your rescue in the unforeseen circumstances when the server malfunctions or you end up messing up with the website code. Not only the websites, a lot of organisations are using AWS to save their organisational data. Also, a lot of them rely on traditional backup software to backup the stored data. The traditional ways to backup your data are slow as well as costly compared to the hassle-free ways available these days.
In this article, I am going to guide you through steps to create a full backup of an Amazon EC2 instances using multiple ways and also, how you can restore the backup if needed.
First of all, before we begin, let’s find out the number of ways using which, you can backup your data from an AWS EC2 instance. The EC2 instance can be configured in two ways and both will have different ways to backup.
- If the EC2 account is EBS enabled, then you can automatically create a snapshot of the EBS volume.
- If the instance is not EBS enabled, you can create an AMI (Amazon Machine Image) of the volume.
Both the above-mentioned backups, snapshot and the AMI, will automatically be saved on Amazon S3. Amazon Simple Storage Service (S3) is a highly durable storage service provided by Amazon. The service is very cheap and comparatively secure than other service providers.
How to backup Amazon EC2 Instance by EBS Snapshot method
The steps given below will help you to create a manual backup of your EC2 instance using EBS method. Once you are done, I will also guide you through to automate the process. Let’s get ahead with the process
To start backing up your instance using EBS Snapshot method, simply follow the below steps
- Open AWS Console and click on EC2 to enter EC2 dashboard.
- Once you are on EC2 dashboard, navigate to your instances by clicking on Instances option in left bar.
- Once you see all your instances on the screen, choose the one which you want to backup.
- Navigate to the description tab, there will be more details about the instance. Click on the detail given after block devices option.
- Once you click on the link, you will get some more details. Out of these details, find out the value given against EBS ID and click on that. To create an EBS snapshot, you will have to click on the action button and select create a snapshot.
- The dialogue box which opens will ask you to give a name and description to the snapshot. Fill in those details and click on create option.
- Once you click create, you will now be able to see the created snapshot in the snapshot section on your EC2 dashboard.
How to restore a created EBS Snapshot on Amazon EC2
- In the EC2 dashboard, navigate to snapshots and locate the snapshot you want to restore.
- Right click on the snapshot and click on create a volume.
- It will ask you to enter a number of values. Fill all of them and click the create button.
- This will create a volume on your EC2 dashboard. The same volume can now be attached to your EC2 instance.
How to backup Amazon EC2 Instance by AMI (Amazon Machine Image) method
If your instance is not EBS backed, you can create a backup using the AMI method. AMI stands for Amazon Machine Image and it is one of the fastest methods of backing up and restoring an EC2 instance. Using an AMI, you can launch a new EC2 instance in the same region and it hardly takes seconds. Let’s have a look at the steps needed
- Select the instance which you want to backup. Once selected, create on the actions button on the top and click on create image.
- The dialogue box which opens will ask you for a number of details related to the new AMI. Fill all these details so that you remember them if you ever need to restore.
- You can also choose “no reboot” option if you want your instance to be in running state while creating the snapshot. The screen will show you a few more options, which you can choose accordingly. These options include customizing the size as well as deleting on termination.
How to automate EC2 backup using EBS Snapshot & AMI Methods