Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Disabling AWS RDS backups when creating/updating instances?

I am creating new RDS MySQL instances from snapshots and updating their configurations both via the API and through the UI. Regardless of how I create or update instances, these actions automatically trigger new snapshots to be created through some kind of automatic backup process. Is there a way to disable snapshot creation when performing these actions since I do not need the additional snapshots and their creation is causing an unnecessary delay?

like image 950
jmsb Avatar asked Feb 29 '16 20:02

jmsb


People also ask

How do I turn off automatic backup on RDS?

To disable automated backups immediatelySign in to the AWS Management Console and open the Amazon RDS console at https://console.aws.amazon.com/rds/ . In the navigation pane, choose Databases, and then choose the DB instance that you want to modify. Choose Modify.

Is RDS backup enabled by default?

Automated Backups Turned on by default, the automated backup feature of Amazon RDS will backup your databases and transaction logs. Amazon RDS automatically creates a storage volume snapshot of your DB instance, backing up the entire DB instance and not just individual databases.

What are the two different ways of automating your RDS backups?

Amazon RDS provides two different methods for backing up and restoring your DB instance(s) automated backups and database snapshots (DB Snapshots).

Can I use AWS backup to manage backups of Amazon RDS DB?

You can also use AWS Backup to manage backups of Amazon RDS DB instances. Backups managed by AWS Backup are considered manual snapshots for the manual snapshot limit. For information about AWS Backup, see the AWS Backup Developer Guide .

What is an RDS backup and how does it work?

RDS creates a storage volume snapshot of your DB instance, backing up the entire DB instance and not just individual databases. RDS saves the automated backups of your DB instance according to the backup retention period that you specify. If necessary, you can recover your database to any point in time during the backup retention period.

What is the default backup retention period for Amazon RDS?

If you don't set the backup retention period, the default backup retention period is one day if you create the DB instance using the Amazon RDS API or the AWS CLI. The default backup retention period is seven days if you create the DB instance using the console.

How do I restore a database instance in AWS?

To restore your database instance, you can use the AWS Console or Command Line Interface. To determine the latest restorable time for a DB instance, use the AWS Console or Command Line Interface to look at the value returned in the LatestRestorableTime field for the DB instance.


1 Answers

I spoke with AWS support and it looks like there is no way to prevent the backup being generated at instance creation time. This is due to how the backup creation on create/update is triggered (it is part of the automated backup process) and limited ability to control this feature (toggle it on and off, but only for existing instances).

Here are some more details in case anyone else runs into the same problems that I did.

I am interested in two scenarios:

  1. Do not create a backup on a RestoreDBInstanceFromDBSnapshot request
  2. Do not create a backup on a ModifyDBInstance request

The backups are controlled by this flag:

BackupRetentionPeriod = 0

Unfortunately this flag is part of an instance and of a snapshot, but can only be set on an instance. Therefore, in order to create an instance with this flag set (and thus no backup generated), the snapshot would have to have this flag disabled. This can only happen if the source instance had this flag disabled. At this point we could consider toggling the flag on the original instance when taking a snapshot, however disabling and re-enabling this flag has negative side effects, including:

There is a way to disable automatic backups for existing instances 
however we highly discourage against this because it disables point-in-time
recovery. Once disabled, re-enabling them will only restore the backups
starting from the time you re-enable automatic backups.

We would lose all existing backups on the original instance. The end result is that there is not an effective way to avoid creating the first backup when an instance is created from a snapshot.

There is better news when updating an existing instance, since we can disable backups as part of the ModifyDBInstance request:

https://rds.amazonaws.com/
  ?Action=ModifyDBInstance
  &DBInstanceIdentifier=mydbinstance
  &BackupRetentionPeriod=0

Of course this still suffers from the loss of backups; however, my original purpose was to be able to create and modify snapshots of production databases, use them for a short period of time (hours), and then throw them away. Avoiding extraneous backup creation reduces overhead in this process.

Hopefully this information is useful to someone else!

like image 165
jmsb Avatar answered Oct 17 '22 02:10

jmsb