How do I perform a backup of my Amazon RDS for MySQL DB instance?

4 minute read
0

I'm trying to perform a backup of my Amazon Relational Database Service (Amazon RDS) for MySQL DB instance. How can I do this?

Short description

Amazon RDS for MySQL creates and saves automated backups of your DB instance during the backup window. A storage volume snapshot of your entire DB instance (and not just individual databases) is created. Amazon RDS then saves the automated backups of your DB instance according to the backup retention period that you specify. During the backup retention period, you can recover your database to any point in time.

However, if your DB instance doesn't have automated backups enabled, you can enable this setting at any time. To enable automated backups, set the backup retention period to a positive nonzero value. When automated backups are enabled, your RDS instance and database is taken offline and a backup is immediately created. The outage occurs when you change the backup retention period from "0" to a nonzero value, or from a nonzero value to "0". This behavior applies to both Single-AZ and Multi-AZ DB instances.

You can also use a cron job to schedule a backup of your Amazon RDS for MySQL instance using either the mysqldump or mysqlbinlog utility. Or, you can perform a manual backup using the AWS Command Line Interface (AWS CLI). The manual snapshots aren't subject to the backup retention period and will not expire.

Note: If you receive errors when running an AWS CLI command, make sure that you’re using the most recent version of the AWS CLI.

Resolution

Enabling automated backups

To enable automated backups in Amazon RDS, perform the following steps:

1.    Open the Amazon RDS console.

2.    From the navigation pane, choose Databases.

3.    Select the DB instance that you want to modify.

4.    Choose Modify. The Modify DB instance page will appear.

5.    For Backup retention period, choose a positive nonzero value (such as "3").

6.    Choose Continue.

7.    Choose Apply immediately.

8.    On the confirmation page, choose Modify DB instance to save your changes and enable automated backups.

Note: When you delete a DB instance, you can still retain automated backups. Retained automated backups include the following:

  • System snapshots of a DB instance
  • Transaction logs from a DB instance
  • DB instance properties (such as allocated storage and DB instance class, which are required to restore the DB instance to an active instance)

You can retain automated backups for Amazon RDS instances running on MySQL, MariaDB, PostgreSQL, Oracle, and Microsoft SQL Server engines. Or, you can use mysqlbinlog (for binlog files) or mysqldump (for logical backups) to back up files to an Amazon Elastic Compute Cloud (Amazon EC2) instance. Then, sync and upload your files to Amazon Simple Storage Service (Amazon S3).

Note: On the read replica, only the Amazon RDS for MySQL or MariaDB read replica can enable backup retention.

Backing up the Amazon RDS for MySQL DB instance on Amazon EC2

To back up your Amazon RDS for MySQL instance on an Amazon EC2 instance, you can choose one of the following methods:


AWS OFFICIAL
AWS OFFICIALUpdated 3 years ago