Help Center/ TaurusDB/ API Reference/ APIs/ Backup Management/ Configuring Same-Region Backup Policies in Batches
Updated on 2026-08-31 GMT+08:00

Configuring Same-Region Backup Policies in Batches

Function

This API is used to configure same-region backup policies in batches. Standard and sparse backup policies are supported. Before calling this API:

Calling Method

For details, see Calling APIs.

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 identity policy-based authorization, the following identity policy-based permissions are required.

    Action

    Access Level

    Resource Type (*: required)

    Condition Key

    Alias

    Dependency

    gaussdbformysql:backup:modifyPolicy

    Permission_management

    -

    gaussdbformysql:ReplicationTargetRegion

    gaussdb:instance:modifyBackupPolicy

    -

URI

POST /v3/{project_id}/instances/backups/policy

Table 1 URI parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Definition

Project ID of a tenant in a region.

To obtain this value, see Obtaining a Project ID.

Constraints

N/A

Range

The value contains 32 characters. Only letters and digits are allowed.

Default Value

N/A

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

Definition

User token. To obtain this value, call the IAM API for obtaining a user token.

The value of X-Subject-Token in the response header is the token value.

Constraints

N/A

Range

N/A

Default Value

N/A

Content-Type

Yes

String

Definition

Content type.

Constraints

N/A

Range

application/json

Default Value

application/json

X-Language

No

String

Definition

Request language type.

Constraints

N/A

Range

  • en-us: English

  • zh-cn: Chinese

Default Value

en-us

Table 3 Request body parameters

Parameter

Mandatory

Type

Description

instance_ids

Yes

Array of strings

Definition

IDs of the instances for which you want to configure a backup policy.

To obtain this value, see Querying DB Instances.

Constraints

A maximum of 50 IDs are allowed.

backup_policy

Yes

MysqlBackupPolicy object

Definition

Database backup policy information.

Constraints

N/A

Table 4 MysqlBackupPolicy

Parameter

Mandatory

Type

Description

begin_time

Yes

String

Definition

Start time of the backup time window.

Constraints

N/A

Range

The value cannot be left blank. It must be a valid value in the hh:mm format. The current time is the UTC time.

Default Value

N/A

end_time

Yes

String

Definition

End time of the backup time window.

Constraints

The value of end_time must be later than that of begin_time.

Range

The value cannot be left blank. It must be a valid value in the hh:mm format. The current time is the UTC time.

Default Value

N/A

retention_num_backup_level1

No

Integer

Definition

Number of retained level-1 backups.

Constraints

This parameter is mandatory when the level-1 backup function is enabled. Otherwise, this parameter cannot be transferred.

Range

  • 0: Level-1 backups are not retained.

  • 1: One level-1 backup is retained.

Default Value

0

policies

Yes

Array of Policy objects

Definition

Backup policies.

Constraints

N/A

Table 5 Policy

Parameter

Mandatory

Type

Description

period

Yes

String

Definition

Backup cycle.

Constraints

The value must be a cron expression in the format of "day month week" in the UTC time zone.

Range

The day can be a number ranging from 1 to 31, the special character * (indicating any value), or the special character L (indicating the last day). You can enter multiple values ranging from 1 to 31 or L and separate them with commas (,).

The month can be a number ranging from 1 to 12 or the special character * (indicating any value).

The week can be a number ranging from 1 to 7 (1 indicates Monday, 2 indicates Tuesday, and so on) or the special character * (indicating any value). You can enter multiple values ranging from 1 to 7 and separate them with commas (,).

Example values:

  • * * 6 indicates that the task is executed every Saturday. This is applicable to weekly policies.

  • * * 1,2,3 indicates that the task is executed every Monday, Tuesday, and Wednesday. This is applicable to weekly policies.

  • 1,2 * * indicates that the task is executed on the first and second days of each month. This is applicable to monthly policies.

  • L * * indicates that the task is executed on the last day of each month. This is applicable to monthly policies.

  • 15 3 * indicates that the task is executed on March 15 every year. This is applicable to yearly policies.

Default Value

N/A

retention_days

Yes

Integer

Definition

Backup retention days.

Constraints

N/A

Range

1–732

You can also contact customer service to extend the retention period to up to 3,660 days.

Default Value

N/A

policy_type

Yes

String

Definition

Backup policy type.

Constraints

N/A

Range

  • base: standard backup policy

  • sparse: sparse backup policy

Default Value

N/A

Response Parameters

Status code: 200

Table 6 Response body parameters

Parameter

Type

Description

failed_results

Array of UpdateBackupPolicyResult objects

Definition

Error information about the backup policy configuration. If the backup policy is successfully configured for all instances, the value is empty.

success_count

Integer

Definition

Number of instances for which the backup policy is successfully configured.

Range

0–50

failed_count

Integer

Definition

Number of instances for which the backup policy configuration failed.

Range

0–50

Table 7 UpdateBackupPolicyResult

Parameter

Type

Description

instance_id

String

Definition

Instance ID.

Range

N/A

error_code

String

Definition

Code returned when an error occurs during backup policy submission.

Range

N/A

error_msg

String

Definition

Message returned when an error occurs during backup policy submission.

Range

N/A

Status code: 400

Table 8 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error message.

Status code: 500

Table 9 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error message.

Example Request

  • Batch configuring a sparse backup policy for multiple instances (Data is backed up from 19:00 to 20:00 every week. Backups are stored for seven days.)

    POST https://{endpoint}/v3/619d3e78f61b4be68bc5aa0b59edcf7b/instances/backups/policy
    
    {
      "instance_ids" : [ "61a4ea66210545909d74a05c27a7179ein07", "61a4ea66210545909d74a05c27a7180in07", "61a4ea66210545909d74a05c27a7181in07" ],
      "backup_policy" : {
        "begin_time" : "19:00",
        "end_time" : "20:00",
        "policies" : [ {
          "period" : "* * 1,2,3,4,5,6,7",
          "retention_days" : 7,
          "policy_type" : "base"
        } ]
      }
    }
  • Modifying the sparse backup policy and standard backup policy of an instance (The standard backup policy is to back up data from 19:00 to 20:00 every day of the week. Backups are stored for seven days. The sparse backup policy is to back up data from Monday to Friday every week. Backups are stored for one day.)

    POST https://{endpoint}/v3/619d3e78f61b4be68bc5aa0b59edcf7b/instances/backups/policy
    
    {
      "instance_ids" : [ "61a4ea66210545909d74a05c27a7179ein07", "61a4ea66210545909d74a05c27a7180in07", "61a4ea66210545909d74a05c27a7181in07" ],
      "backup_policy" : {
        "begin_time" : "19:00",
        "end_time" : "20:00",
        "policies" : [ {
          "period" : "* * 1,2,3,4,5,6,7",
          "retention_days" : 7,
          "policy_type" : "base"
        }, {
          "period" : "* * 1,2,3,4,7",
          "retention_days" : 1,
          "policy_type" : "sparse"
        } ]
      }
    }

Example Response

Status code: 200

Success.

{
  "failed_results" : [ {
    "instance_id" : "61a4ea66210545909d74a05c27a7179ein07",
    "error_code" : "DBS.280500",
    "error_msg" : "Instance status not allowed"
  }, {
    "instance_id" : "71a4ea66210545909d74a05c27a7179ein07",
    "error_code" : "DBS.280404",
    "error_msg" : "Instance not found"
  } ],
  "success_count" : 3,
  "failed_count" : 2
}

Status Code

For details, see Status Codes.

Error Code

For details, see Error Codes.