How do I automate frequent backups of my Amazon RDS MySQL DB instance?

5 minute read
1

I want to automate frequent backups of my Amazon Relational Database Service (Amazon RDS) MySQL DB instance. How do I set this up?

Short description

Amazon RDS automatically creates a backup of the underlying storage volumes associated with your Amazon RDS DB instance. All of your data is backed up into Amazon Simple Storage Service (Amazon S3), based on a retention policy that runs for up to 35 days. These backups allow you to perform a point-in-time recovery (PITR) at any time within your retention period.

By default, this automation occurs only once each day during a 30 minute backup window. If you need the automated backup to run more frequently, you can use the following methods:

This article will cover the following sub-topics:

  • Create an automated backup job in Amazon RDS using AWS Backup.
  • Is there downtime for enabling Amazon RDS automated backups?
  • How can I get notified if my AWS Backup job has failed?
  • What happens if my Amazon RDS automated backup fails?

Resolution

Create an automated backup job in Amazon RDS using AWS Backup

To create an automated backup job in Amazon RDS, which captures daily snapshots at a specific interval, perform the following steps:

1.    Open the AWS Backup console.

2.    Choose Build a new plan to create a new backup plan.

3.    Enter the Backup plan name and any relevant tag information.

4.    Under Backup configuration, update the following:
Backup plan name
Backup vault
Backup frequency
Backup window

For example, if you want to schedule your automated backup to run every six hours, and to complete within three hours, update the following:
For Backup frequency, select the Custom cron expression and type "cron(0 0/6 ? * * *)" for your cron expression.
For Backup window, select "Start within 1 hour" and "Complete within 3 hours".

5.    Choose Copy automatically to a target region.

Note: Not all AWS Regions are supported for automatic cross-Region copies. For more information, see Replicating automated backups to another AWS region.

6.    Specify the desired retention period for your automated backup. Amazon RDS Backup will retain the backup for the specified duration until the backup is automatically deleted.

7.    Choose Create plan.

8.    Under the Newly created backup plan tab, choose Assign resources.

9.    Assign your resources by updating the following information:
Resource assignment name
AWS Identity Access Management (IAM) role (to create and manage DB instance recovery points)
Amazon RDS resource (by tag or resource ID)

Note: AWS Backup snapshots are denoted by the prefix “awsbackup:job-”.

Is there downtime for enabling Amazon RDS automated backups?

When you enable Amazon RDS automated backups, an outage can occur when you update the backup retention period from "0" to a nonzero value. An outage can also occur when you update from a nonzero value to "0". The outage will be equivalent to the duration of a reboot and any engine recovery tasks performed during the engine startup.

Note: If you disable automated backups in Amazon RDS, all of your previous automated backup jobs will also be deleted.

How can I get notified if my AWS Backup job has failed?

If your AWS Backup job has failed, configure your backup vault to send notifications to an SNS topic, notifying you of your job status. For more information, see How can I get notifications for AWS Backup jobs that failed?

What happens if my Amazon RDS automated backup fails?

The following conditions must be met for Amazon RDS to successfully perform an automated backup:

  • Your DB instance must be in the AVAILABLE state for automated backups to occur.
  • A copy of your DB instance cannot be running in the same AWS Region as the original DB instance.

Although unlikely, if your Amazon RDS automated backup fails and the process does not complete before the end of a scheduled backup, Amazon RDS will retry the process. The automated backup will then take place during the next backup window. Otherwise, if your backup is progressing, it will (and can) continue beyond the specified window.

Tip: Use AWS Backup to manage both Amazon RDS snapshots and continuous backups with point-in-time recovery. Otherwise, your backups will fail when initiated during the default 30 minute backup window. To troubleshoot any issues with creating backups in Amazon RDS, see Troubleshooting creating resources.


Related information

Working with backups

How can I get notifications for AWS Backup jobs that failed?