Help Center/ GaussDB/ API Reference/ APIs (Recommended)/ Backup and Restoration/ Configuring an Automated Backup Policy
Updated on 2025-08-19 GMT+08:00

Configuring an Automated Backup Policy

Function

This API is used to configure an automated backup policy. Before calling this API:

URI

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

Table 1 Parameter description

Parameter

Mandatory

Description

project_id

Yes

Definition

Project ID of a tenant in a region.

To obtain the value, see Obtaining a Project ID.

Constraints

N/A

Range

The value can contain 32 characters. Only letters and digits are allowed.

Default Value

N/A

instance_id

Yes

Definition

Instance ID, which uniquely identifies an instance.

Constraints

N/A

Range

The value can contain 36 characters. Only letters and digits are allowed.

Default Value

N/A

Request Parameters

Table 2 Parameter description

Parameter

Mandatory

Type

Description

backup_policy

Yes

Object

Definition

Backup policy information.

For details, see Table 3.

Constraints

N/A

Range

N/A

Default Value

N/A

Table 3 backup_policy field data structure description

Parameter

Mandatory

Type

Description

keep_days

Yes

Integer

Definition

Backup retention days.

Constraints

N/A

Range

1–36,500 days

Default Value

N/A

start_time

Yes

String

Definition

Backup time window. Automated backups will be created during the backup time window.

Constraints

N/A

Range

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

The value of HH must be 1 greater than the value of hh. The values of mm and MM must be the same and must be 00.

Example value:

21:00-22:00

Default Value

N/A

NOTE:

This parameter indicates the time period (in UTC format) during which backup is performed. For example, if the local backup time is 05:00-06:00 and the time zone is UTC+08:00, set the parameter value to 21:00-22:00. If the time zone is UTC+04:00, set the value to 01:00-02:00.

period

Yes

String

Definition

Full backup period. An automated full backup is performed on the UTC date of each week.

Constraints

N/A

Range

1–7. The numbers are separated by commas (,), indicating the days of the week.

Example value:

  • 1,2,3,4 indicates that the backup period is Monday, Tuesday, Wednesday, and Thursday.
  • 1,2,3,4,5,6,7 indicates that an automated backup is performed every day from Monday to Sunday.
  • 1,3,5 indicates that an automated backup is performed on Monday, Wednesday, and Friday.

Default Value

N/A

NOTE:

This parameter indicates the date (in UTC format) on which backup is performed. For example, if the local backup time is 05:00-06:00 on Monday and Tuesday, and the time zone is UTC+08:00, set the parameter value to 1,7. If the time zone is UTC+04:00, set the value to 1,2.

differential_period

Yes

String

Definition

Differential backup interval. Interval for automated differential backup.

Constraints

N/A

Range

The value can be 15, 30, 60, 180, 360, 720, or 1440 minutes.

Example value: 30

Default Value

N/A

rate_limit

No

Integer

Definition

Upload speed at which backup data is uploaded to OBS. The upload speed is related to the bandwidth used for data upload.

Constraints

N/A

Range

0–1024 MB/s. The value 0 indicates no limit.

Default Value

75 MB/s

prefetch_block

No

Integer

Definition

Number of prefetch pages from the modified pages in the disk table file during a differential backup. When modified pages are adjacent (for example, with a bulk data load), you can set this parameter to a large value. When modified pages are scattered (for example, random update), you can set this parameter to a small value.

Constraints

N/A

Range

1–8192

Default Value

64

file_split_size

No

Integer

Definition

Size by which full and differential backup files are split.

Constraints

The value must be a multiple of 4.

Range

0–1024 GB. 0 GB indicates that the size is not limited.

Default Value

4 GB

enable_standby_backup

No

Boolean

Definition

Whether to enable backup on a standby node.

Constraints

It is not suitable for single-node instances and instances earlier than 3.100.0.

Range

  • true: This function is enabled.
  • false: This function is disabled.

Default Value

N/A

Response Parameters

None

Example Request

Configuring a backup policy for GaussDB (Set backup retention period to seven days and backup time window to 19:00-20:00).
PUT https://gaussdb-opengauss.ap-southeast-1.myhuaweicloud.com/v3/0483b6b16e954cb88930a360d2c4e663/instances/dsfae23fsfdsae3435in14/backups/policy
{
	"backup_policy": {
		"keep_days": 7,
		"start_time": "19:00-20:00",
		"period": "1,2,3,4,5",
		"differential_period": "30",
		"rate_limit": 75 ,
                "prefetch_block": 64 ,
                "file_split_size": 4 ,
                "enable_standby_backup" : false
 
 
 
 
 
	}
}

Example Response

{}

Status Codes

Error Codes

For details, see Error Codes.