amazon-web-servicesdatabase-backupsmysql-backupamazon-rds

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?


Solution

  • 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!