How to take and restore a snapshot on AWS RDS MySQL Instance
Creating a snapshot of the RDS instance makes a complete copy of the entire DB instance and not just the individual database. It creates a storage volume snapshot of the DB instance. The time required to take a snapshot of the RDS instance varies with the size of the databases.
The snapshot that is created can be used to restore the data to a DB instance. The data can not be restored to an existing database instance from the snapshot, rather a new database instance is created when the snapshot is restored. If the DB snapshot is both shared and encrypted, it can not be used to restore to a database instance.
In this article, we will see the steps to create a snapshot of the existing RDS MySql Instance. Then we will see the steps to restore the snapshot which creates a new RDS Instance. At last, we will clean up the instances and snapshots.
This is a manual way to create snapshots of RDS instances. Snapshots are also created and saved automatically in a backup window of the DB instance. Automated backups take place when the DB instance is in the "Available" state.
- AWS Account (Create if you don’t have one).
- At least one RDS MySql Instance.
What will we do?
- Login to AWS.
- Create a snapshot.
- Restore the snapshot.
- Delete the database instance.
- Delete the snapshots.
Login to AWS
Click here to go to AWS Login Page.
When we hit the above link, we will see a web page as follows where we are required to log in using our login details.
You will see the main AWS Management console as follows when you successfully login into your account.
Create a snapshot
Search for RDS in the search box which appears when you click on Services in the top left of the screen.
Click on the result.
This is the main dashboard of the RDS Service
It is assumed that you already have an RDS MySql instance and you want to take a snapshot of the existing instance
Click on "Databases" in the left panel.
You will get a list of instances you have in the chosen region.
Click on the instance you want to take a snapshot of, "Actions" and then click on "Take snapshot".
Give a name to the snapshot and click on the "Take snapshot" button to proceed.
The snapshot is being taken, this will take some time. Once the snapshot is ready, you can see "available" under status.
Restore a snapshot
The snapshot you have taken is now ready to be restored. When the snapshot is restored, it creates a new instance with data that is there in the snapshot.
To restore the snapshot, go to "Snapshots" in the left panel and select the snapshot to be restored. Click on the "Actions" button and then "Restore snapshot".
Here, you need to provide all the information that is provided while creating an RDS Instance.
Give a name to the instance that will be created using this snapshot, specify the VPC.
Create a new Security group or choose the one which belongs to the Instance from which you created a snapshot.
Choose the size of the RDS instance that will be created using this snapshot.
Once you provide all the relevant configuration, click on "Restore DB instance."
This will take some time, wait till then.
Once the snapshot is restored successfully, you will see the status changed to "Available".
Delete the database instance.
When you no longer need the instances, it is better to delete them. To delete the instance, select the instance and click on "Actions" --> "Delete".
Be careful while performing the deletion operation. You can even take a snapshot of the RDS instance before deleting it.
Acknowledge the deletion action and click on the "Delete" button
Delete a snapshot
To delete the snapshot if not needed, go to Snapshot and select the snapshot to be deleted and click on "Actions" --> "Delete the snapshot".
Click on ''Delete" to confirm the deletion action. Once the snapshot is deleted, there is no way to retrieve it. Be careful while you perform the deletion action.
In this article, we saw the steps to create a snapshot of an existing RDS MySql instance and restore it. At last, we also saw how to clean up RDS instances and snapshots.