Amazon Relational Database Service (Amazon RDS) enables you to run a fully-featured relational database on Amazon cloud. This service, offered by Amazon, is easy to set up, operate, and scale a relational database on cloud and offloads database
Amazon RDS allows you to choose from six familiar database engines - Amazon Aurora, PostgreSQL, MySQL, MariaDB, Oracle Database, and SQL Server. It lets you create DB instance - an isolated database environment running on cloud. A DB instance can be created by using AWS Management Console, Amazon AWS command line tools, and Amazon RDS API. You can create multiple databases within a DB instance.
As these DB instances contain your databases, they need to be backed up so as to prevent data loss.
Amazon RDS DB Instance Backup and Restore
Amazon RDS helps you back up DB instances in two ways:
1. Automatic Backup
2. Manual Backup
By default, Amazon RDS creates backup or database snapshots of your DB instance automatically. However, you can also create DB snapshots manually. These backups are by default save in Amazon Simple Storage Service (Amazon S3) bucket – cloud storage.
You can restore the DB instance at any point in time by creating a new DB instance and by using the available database snapshots.
The table below highlights some key features of Automatic Backup and Manual Backup:
|Automatic Backup||Manual Backup
|Created automatically||User-initiates backup by creating DB snapshot
|Defined retention period (up to 35 days)||DB snapshot can be created by using AWS Management Console, AWS CLI, or RDS API
|Setting the backup retention period to 0 disables automated backups and deletes all existing automated backups for the instance||Manually created DB snapshots aren’t deleted until you explicitly delete them
|Default location of backed up DB instance is Amazon S3 bucket||Default location of backed up DB instance is Amazon S3 bucket
|Backs up the entire DB instance|
|Gets deleted, if the DB instance is deleted without choosing Retain automated backups|
|Occurs daily during the backup window|
Automatic backup creates a snapshot of the entire DB instance. This backup runs daily during the preferred backup window, defined while creating the DB instance. In case a preferred backup window is not defined, Amazon RDS assigns a default 30-minute backup window.
The automatically created DB snapshot is retained in the location as per the defined retention period (between 0 and 35 days).
[NOTE]: Modifying the retention period of a DB instance to 0 (zero) would disable the automatic backup. In such a case, all the previously created automatic backups for the instance will be deleted and can’t be recovered.
However, if you don’t set this value, the default values apply, such as:
- If you create the DB instance by using the AWS Management Console, the default backup retention period is seven days.
- If you create the DB instance by using the Amazon RDS API or the AWS CLI, the default backup retention period is one day.
Data Loss Risks with Automatic Backup
While automatic backup makes the backup job easy and saves your time, it may lead to data loss. Some data loss risks associated with automatic backup are:
- If retention period of automatic backup has passed, the backup will be deleted. You won’t be able to restore the DB instance, if required.
- While deleting a DB instance, if you don’t choose Retain automated backups, all automated backups are deleted with the DB instance.
Amazon RDS lets you back up a DB instance manually. To do this, you need to manually create DB snapshot of the DB instance you want to back up. You can use AWS Management Console, AWS CLI, or RDS API to create DB snapshots.
To create a snapshot, you need to first identify the DB instance you want to back up, and assign a name to the DB snapshot.
The first snapshot of a DB instance is the full backup of DB instance, while the subsequent snapshots of the same DB instance are incremental. This means, the next time you create a snapshot of the same DB instance, only the data that has changed after your most recent snapshot is saved.
[NOTE]: The time taken for creating a snapshot may vary, depending on the size of databases.
Unlike automated backups, manual snapshots aren't subject to the backup retention period. They don't expire or get automatically deleted when you delete the DB instance. They can only be deleted manually.
Restoring RDS DB Instance from DB Snapshot
You can restore a DB instance from a manual or automatically created snapshot, provided that you haven’t deleted the manual snapshot or automated snapshot hasn’t expired/deleted.
AWS Management Console, AWS CLI, or RDS API is the tools which you can use to restore a DB instance from a DB snapshot.
- A DB instance cannot be restored to an existing DB instance. Restoring a DB instance from its snapshot creates a new DB instance.
- You can't restore a DB instance from a DB snapshot that is both shared and encrypted.
While restoring, you need to provide the name of DB snapshot from which you want to restore a DB instance. Next, you need to assign a name to the new DB instance that will be created and contain the restored databases.
Amazon RDS helps you host your database on cloud. It also allows you to automatically or manually create backup of your DB instances in the form of DB snapshots. You can restore the DB instance from such snapshots, if required.
Automatic backups are retained only for specified retention period. Past this retention period, they’re automatically deleted. However, manual backups can be deleted only when you manually delete them.
If you have the backup of a DB instance, you can easily restore it by using AWS Management Console, the AWS CLI, or the RDS API.
If you’re using only a local server for DB instance backup, and have lost/deleted the local backup and are unable to restore the DB instance, you can contact a database recovery expert such as Stellar®, who can help you recover your crucial business data with utmost safety and privacy.