Updated on 2026-01-05 GMT+08:00

Setting an Automated Backup Policy

Function

This API is used to set an automated backup policy.

Authorization Information

Each account has all the permissions required to call all APIs, but IAM users must be assigned the required permissions.
  • If you are using role/policy-based authorization, see Permissions and Supported Actions for details on the required permissions.
  • If you are using identity policy-based authorization, the following identity policy-based permissions are required.

Action

Access Level

Resource Type (*: required)

Condition Key

Alias

Dependencies

rds:instance:modifyBackupPolicy

permission_management

instance

g:EnterpriseProjectId

rds:BackupEnabled

g:ResourceTag/<tag-key>

-

-

URI

  • URI format

    PUT /v3/{project_id}/instances/{instance_id}/backups/policy

  • Parameter description
    Table 1 Parameters

    Parameter

    Mandatory

    Description

    project_id

    Yes

    Definition

    Project ID of a tenant in a region.

    Constraints

    The value cannot be empty.

    Range

    To obtain the value, see Obtaining a Project ID.

    Default Value

    N/A

    instance_id

    Yes

    Definition

    Instance ID.

    Constraints

    The value cannot be empty.

    Range

    You can obtain the value of this parameter from id in Table 4 by calling the API for querying DB instances.

    Default Value

    N/A

Request

Table 2 Parameters

Parameter

Mandatory

Type

Description

backup_policy

Yes

Object

Definition

Backup policy objects, including the backup retention period (days) and backup start time.

For details, see Table 3.

Constraints

N/A

reserve_backups

No

Boolean

Definition

Whether to retain automated backups and differential backups.

Constraints

This parameter is valid only when the backup policy is disabled.

Range

  • true: Retain automated backups and differential backups when the backup policy is disabled.
  • false: Delete the existing automated backups and differential backups when the backup policy is disabled.

Default Value

true

Table 3 backup_policy field data structure description

Parameter

Mandatory

Type

Description

keep_days

Yes

Integer

Definition

Specifies the number of days to retain the generated backup files.

Constraints

N/A

Range

1–732 To extend the retention period, submit a service ticket. Automated backups can be retained for up to ten years.

Default Value

N/A

start_time

No

String

Definition

Specifies the backup time window. Automated backups will be triggered during the backup time window. This parameter is mandatory except that the automated backup policy is disabled.

Constraints

N/A

Range

The value must be a valid value in the hh:mm-HH:MM format. The current time is the UTC time.

  • The HH value must be 1 greater than the hh value.
  • The values of mm and MM must be the same and must be set to any of the following: 00, 15, 30, or 45.

    Example value:

    • 08:15-09:15
    • 23:00-00:00

Default Value

N/A

period

No

String

Definition

Specifies the backup cycle configuration. Data will be automatically backed up on the selected days every week. This parameter is mandatory except that the automated backup policy is disabled.

Constraints

N/A

Range

The value is a list of digits separated by commas (,). Each digit indicates a day of the week.

For example, the value 1,2,3,4 indicates that the backup period is Monday, Tuesday, Wednesday, and Thursday.

Default Value

N/A

Example Request

Configure an automated backup policy for a DB instance, with backup cycle set to Monday and Tuesday, backup window to 19:00–20:00, and retention period to 7 days.
PUT https://{endpoint}/v3/0483b6b16e954cb88930a360d2c4e663/instances/dsfae23fsfdsae3435in01/backups/policy

{
	"backup_policy": {
		"keep_days": 7,
		"start_time": "19:00-20:00",
		"period": "1,2"
	}
}

Response

Status Code

Error Code

For details, see Error Codes.