Modifies the backup settings of an ApsaraDB for RDS instance.

Before you call this operation, make sure that the following requirements are met:

  • The instance must not be a read-only instance.
  • The instance must be in the Running state.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter Type Required Example Description
Action String Yes ModifyBackupPolicy

The operation that you want to perform. Set the value to ModifyBackupPolicy.

DBInstanceId String Yes rm-uf6wjk5xxxxxxx

The ID of the instance.

BackupPolicyMode String No DataBackupPolicy

The type of backup to use for the instance. Valid values:

  • DataBackupPolicy
  • LogBackupPolicy
PreferredBackupTime String No 00:00Z-01:00Z

The time to execute the backup task. Specify the time in the ISO 8601 standard in the HH:mmZ-HH:mmZ format. The time must be in UTC.

Note This parameter must be specified when the BackupPolicyMode parameter is set to DataBackupPolicy.
PreferredBackupPeriod String No Monday

The cycle to back up the instance. Specify at least two days and separate them with commas (,). You can retain the default value. Valid values:

  • Monday
  • Tuesday
  • Wednesday
  • Thursday
  • Friday
  • Saturday
  • Sunday
Note This parameter must be specified when the BackupPolicyMode parameter is set to DataBackupPolicy.
BackupRetentionPeriod String No 7

The number of days to retain data backup files. Valid values: 7 to 730. You can retain the default value.

Note This parameter must be specified when the BackupPolicyMode parameter is set to DataBackupPolicy.
BackupLog String No Enable

Specifies whether to enable log backup. Valid values: Enable | Disabled. You can retain the default value.

Note This parameter must be specified when the BackupPolicyMode parameter is set to LogBackupPolicy.
LogBackupRetentionPeriod String No 7

The number of days to retain binary log files. Valid values: 7 to 730. The log backup retention period cannot be longer than the data backup retention period.

Note You can only specify this parameter when the instance runs MySQL, PostgreSQL, or PPAS and log backup is enabled.
EnableBackupLog String No 1

Specifies whether to enable log backup. Valid values:

  • True or 1: specifies to enable log backup.
  • False or 0: specifies to disable log backup.
Note This parameter must be specified when the BackupPolicyMode parameter is set to LogBackupPolicy.
LocalLogRetentionHours String No 18

The number of hours to retain binary log files on the instance. Valid values: 0 to 7 × 24. Value 0 specifies not to retain binary log files on the instance. You can retain the default value.

Note This parameter must be specified when the BackupPolicyMode parameter is set to LogBackupPolicy.
LocalLogRetentionSpace String No 30

The maximum percentage of space allowed to store binary log files on the instance. If the space usage for binary log files exceeds this percentage, the system deletes earlier binary log files until the space usage falls below this percentage. Valid values:0 to 50. You can retain the default value.

Note This parameter must be specified when the BackupPolicyMode parameter is set to LogBackupPolicy.
HighSpaceUsageProtection String No Enable

Specifies whether to delete binary log files when the space usage of the instance exceeds 80% or the remaining space is less than 5 GB. Valid values: Enable | Disable. You can retain the default value.

Note This parameter must be specified when the BackupPolicyMode parameter is set to LogBackupPolicy.
LogBackupFrequency String No LogInterval

The frequency to back up binary logs on the instance. Valid values:

  • Value LogInterval specifies to back up binary logs every 30 minutes.
  • The default value is the same as the data backup frequency.
Note Value LogInterval is only supported when the instance runs SQL Server.
CompressType String No 4

The format to compress backup data. Valid values:

  • 1: The zlib tool is used to compress data into .tar.gz files.
  • 4: The QuickLZ tool is used to compress data into .xb.gz files. This compression format is only supported when the instance runs MySQL 5.6 or 5.7. It can be used to restore individual databases or tables.
  • 8: The QuickLZ tool is used to compress data into .xb.gz files. This compression format is only supported when the instance runs MySQL 8.0. It cannot be used to restore individual databases or tables.
ArchiveBackupRetentionPeriod String No 365

The number of days to retain archived backups. Valid values: 30 to 1095. Default value: 0. Value 0 specifies not to enable backup archiving.

ArchiveBackupKeepPolicy String No ByMonth

The cycle to retain archived data backup files. The number of archived data backup files that can be retained within a cycle is determined by the ArchiveBackupKeepCount parameter. Valid values:

  • ByMonth
  • ByWeek
  • KeepAll

Default value: 0.

ArchiveBackupKeepCount String No 1

The number of archived data backup files you want to retain. Valid values:

  • If you set the ArchiveBackupKeepPolicy parameter to ByMonth, the value of the ArchiveBackupKeepCount ranges from 1 to 31.
  • If you set the ArchiveBackupKeepPolicy parameter to ByWeek, the value of the ArchiveBackupKeepCount parameter ranges from 1 to 7.

Default value: 1.

Note You do not need to specify this parameter when the ArchiveBackupKeepPolicy parameter is set to KeepAll.
ReleasedKeepPolicy String No None

The policy to retain archived data backup files if the instance is released. Valid values:

  • None: No archived data backup files are retained.
  • Lastest: Only the last archived data backup file is retained.
  • All: All archived data backup files are retained.

Default value: None.

LogBackupLocalRetentionNumber Integer No 60

The number of binary log files you want to retain on the instance. Valid values: 6 to 100. Default value: 60.

Response parameters

Parameter Type Example Description
RequestId String DA147739-AEAD-4417-9089-65E9B1D8240D

The ID of the request.

DBInstanceID String rm-uf6wjk5xxxxxxx

The ID of the instance.

EnableBackupLog String 1

Indicates whether log backup is enabled. Valid values:

  • 1: Log backup is enabled.
  • 0: Log backup is disabled.
LocalLogRetentionHours Integer 18

The number of hours to retain binary log files on the instance.

LocalLogRetentionSpace String 30

The maximum percentage of space allowed to store binary log files on the instance.

HighSpaceUsageProtection String Disable

Indicates whether to delete binary log files when the space usage of the instance exceeds 80% or the remaining space is less than 5 GB.

CompressType String 4

The format used to compress backups. Valid values:

  • 0: Backups are not compressed.
  • 1: Backups are compressed by using zlib.
  • 2: Backups are compressed in parallel by using zlib.
  • 4: Backups are compressed by using QuickLZ and can be used to restore individual databases or tables.
  • 8: Backups are compressed by using QuickLZ but cannot be used to restore individual databases or tables. This value is only supported when the instance runs MySQL 8.0.
LogBackupLocalRetentionNumber Integer 60

The number of binary log files retained on the instance.

Examples

Sample requests

http(s)://rds.aliyuncs.com/? Action=ModifyBackupPolicy
&DBInstanceId=rm-uf6wjk5xxxxxxx
&BackupPolicyMode=LogBackupPolicy
&EnableBackupLog=True
&HighSpaceUsageProtection=Enable
&<Common request parameters>

Sample success responses

XML format

<ModifyBackupPolicyResponse>
        <HighSpaceUsageProtection>Disable</HighSpaceUsageProtection>
      <DBInstanceID>rm-bp1z3xxxxx</DBInstanceID>
      <RequestId>E4BF5598-ED12-4406-AAA4-F375428BE741</RequestId>
      <LocalLogRetentionHours>18</LocalLogRetentionHours>
      <EnableBackupLog>1</EnableBackupLog>
      <LocalLogRetentionSpace>30</LocalLogRetentionSpace>
      <LogBackupLocalRetentionNumber>60</LogBackupLocalRetentionNumber>
</ModifyBackupPolicyResponse>

JSON format

{
    "HighSpaceUsageProtection": "Disable",
    "DBInstanceID": "rm-bp1z3xxxxx",
    "RequestId": "E4BF5598-ED12-4406-AAA4-F375428BE741",
    "LocalLogRetentionHours": "18",
    "EnableBackupLog": "1",
    "LocalLogRetentionSpace": "30",
    "LogBackupLocalRetentionNumber": 60
}

Error codes

For a list of error codes, visit the API Error Center.