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 create for the instance. Valid values:

  • DataBackupPolicy: specifies to create data backups.
  • LogBackupPolicy: specifies to create log backups.
PreferredBackupTime String No 00:00Z-01:00Z

The point in time at which to run backup tasks. Specify the time in the ISO 8601 standard in the HH:mmZ-HH:mmZ format. The time must be in UTC.

Note You must specify this parameter when the BackupPolicyMode parameter is set to DataBackupPolicy.
PreferredBackupPeriod String No Monday

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

  • Monday
  • Tuesday
  • Wednesday
  • Thursday
  • Friday
  • Saturday
  • Sunday
Note You must specify this parameter when the BackupPolicyMode parameter is set to DataBackupPolicy.
BackupRetentionPeriod String No 7

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

Note You must specify this parameter when the BackupPolicyMode parameter is set to DataBackupPolicy.
BackupLog String No Enable

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

Note You must specify this parameter when the BackupPolicyMode parameter is set to LogBackupPolicy.
LogBackupRetentionPeriod String No 7

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

Note If you enable the log backup function, you can specify the log backup retention period. This applies only when the instance runs MySQL, PostgreSQL, or PPAS.
EnableBackupLog String No 1

Specifies whether to enable the log backup function. Valid values:

  • True or 1: specifies to enable the log backup function.
  • False or 0: specifies to disable the log backup function.
Note You must specify this parameter when the BackupPolicyMode parameter is set to LogBackupPolicy.
LocalLogRetentionHours String No 18

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

Note You must specify this parameter when the BackupPolicyMode parameter is set to LogBackupPolicy.
LocalLogRetentionSpace String No 30

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

Note You must specify this parameter when the BackupPolicyMode parameter is set to LogBackupPolicy.
HighSpaceUsageProtection String No Enable

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

Note You must specify this parameter when the BackupPolicyMode parameter is set to LogBackupPolicy.
LogBackupFrequency String No LogInterval

The frequency at which to back up logs. Valid values:

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

The format used to compress backups. Valid values:

  • 1: The zlib tool is used to compress backups into .tar.gz files.
  • 4: The QuickLZ tool is used to compress backups into .xb.gz files. This compression format is supported only when the instance runs MySQL 5.6 or 5.7. It can be used to restore individual databases and tables.
  • 8: The QuickLZ tool is used to compress backups into .xb.gz files. This compression format is supported only 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 for which to retain archived backups. The default value 0 specifies not to enable the backup archiving function. Valid values: 30 to 1095.

ArchiveBackupKeepPolicy String No ByMonth

The period for which to retain archived backups. The number of archived backups that can be retained within the specified period is determined by the ArchiveBackupKeepCount parameter. Default value: 0. Valid values:

  • ByMonth
  • ByWeek
  • KeepAll
ArchiveBackupKeepCount String No 1

The number of archived backups that can be retained. Default value: 1. Valid values:

  • The value of this parameter ranges from 1 to 31 when the ArchiveBackupKeepPolicy parameter is set to ByMonth.
  • The value of this parameter ranges from 1 to 7 when the ArchiveBackupKeepPolicy parameter is set to ByWeek.
Note You do not need to specify this parameter when the ArchiveBackupKeepPolicy parameter is set to KeepAll.
ReleasedKeepPolicy String No None

The policy used to retain archived backups if the instance is released. Default value: None. Valid values:

  • None: No archived backups are retained.
  • Lastest: Only the last archived backup is retained.
  • All: All of the archived backups are retained.
LogBackupLocalRetentionNumber Integer No 60

The number of log backup files that can be retained on the instance. Default value: 60. Valid values: 6 to 100.

Category String No Standard

Specifies whether to enable the second-level backup function. This function allows a backup to be completed within seconds. Valid values:

  • Flash: specifies to enable the second-level backup function.
  • Standard: specifies to disable the second-level backup function.

Response parameters

Parameter Type Example Description
CompressType String 4

The format used to compress backups. Valid values:

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

The ID of the instance.

EnableBackupLog String 1

Indicates whether the log backup function is enabled. Valid values:

  • 1: The log backup function is enabled.
  • 0: The log backup function is disabled
HighSpaceUsageProtection String Disable

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

LocalLogRetentionHours Integer 18

The number of hours for which log backup files can be retained on the instance.

LocalLogRetentionSpace String 30

The maximum percentage of space that is allowed to store log backup files on the instance.

LogBackupLocalRetentionNumber Integer 60

The number of log backup files that can be retained on the instance.

RequestId String DA147739-AEAD-4417-9089-65E9B1D8240D

The ID of the request.

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.