This week I will explain Amazon RDS restore. If we somehow need to restore our data , AWS let us have different choices. We can use Amazon RDS snapshots or “restore to point in time” to restore our data. Before starting our demo, I want to explain Amazon RDS restore options. Amazon RDS snapshots are created automatically ( with automated backups ) and manually. Automated snapshots are deleted if you terminate your RDS instance but manually created ones are kept if you don’t delete them even if you terminate the instance. So we can use our snapshots anytime we want to restore our databases. Also when automated backups enabled ( by default it is ), we can use “restore to point in time” option. We can see the “latest restorable time” using console or using cli. We can restore to the latest time or a custom time during our backup retention period. In both options, backup is used to create a new instance using our source instance/snapshot. After we create the new instance, we can copy data and use it as we need.
AWS RDS restore operations are really too easy to do and I will show them via AWS console. So let’s start with Amazon RDS Snapshot.
Automated backups are enabled for my RDS instance and as you see there are 3 snapshots created automatically. Also I take a manual snapshot of my instance.
Now I will use the snapshot created on Mar 2, 2015, 7:19:30 AM. On snapshots tab, I select it and click “Restore Snapshot” button. Here I have to name the “Db Instance Identifier”.
And our new instance is being created.
Let’s connect to our instance and dump our database.
mysql> show databases; +--------------------+ | Database | +--------------------+ | information_schema | | innodb | | mysql | | osalkk_wp1 | | performance_schema | | rdsdemo | +--------------------+ 6 rows in set (0.08 sec)
onur@onur-mint:~$ mysqldump rdsdemo -h restored-rds-test.c0su4skrtq4v.eu-west-1.rds.amazonaws.com -u root -p > rdsdemo.sql
Now we can use this dump file and restore it to our source instance or somewhere else.
Next I will show “restore to point in time” option.
Using console again, I select “restore to point int time” option from instance actions.
I give a db instance identifier and select a custom date. You can use the latest restorable time if you want.
After our instance is created, we can connect and dump our data again. As I said, there operation are very easy to manage. I will explain AWS RDS database log files. If you have any question or comment, please feel free to write and don’t forget to share please.