Updated on 2024-06-07 GMT+08:00

Setting a Cross-Region Backup Policy

Function

This API is used to set a cross-region backup policy in the source backup region.

  • Before calling an API, you need to understand the API in Authentication.

Constraints

  • If the cross-region backup policy has been enabled, call the API to set the cross-region backup policy. Only the retention period can be changed.
  • For RDS for MySQL and RDS for PostgreSQL DB instances, the retention period of automated full backups must be the same as that for automated incremental backups.
  • For RDS for MySQL and RDS for PostgreSQL DB instances, automated incremental backup cannot be enabled unless automated full backup is enabled first.
  • For RDS for MySQL and RDS for PostgreSQL DB instances, if you want to disable automated full backup and automated incremental backup, disable automated incremental backup first.
  • Cross-region backup is not supported for RDS for MySQL or RDS for PostgreSQL instances with volume snapshot backup is enabled.

URI

  • URI format

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

  • Parameter description
    Table 1 Parameter description

    Name

    Mandatory

    Description

    project_id

    Yes

    Project ID of a tenant in a region.

    For details about how to obtain the project ID, see Obtaining a Project ID.

    instance_id

    Yes

    Specifies the DB instance ID.

Request

Table 2 Parameter description

Name

Mandatory

Type

Description

policy_para

Yes

Object

Specifies the backup policy object, including the backup type, backup retention days, target region ID, and target project ID.

For details, see Table 3.

Table 3 policy_para field data structure description

Name

Mandatory

Type

Description

backup_type

Yes

String

Specifies the backup type.

For RDS for SQL Server, this parameter can only be set to all.

Its value can be any of the following:

  • auto: automated full backup
  • incremental: automated incremental backup
  • all: all backup types
    • RDS for MySQL: Enable automated full backup and automated incremental backup.
    • RDS for PostgreSQL: Enable automated full backup and automated incremental backup.
    • RDS for SQL Server: Enable automated full backup, automated incremental backup, and manual backup.

keep_days

Yes

Integer

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

Value range: 0-1825

The value 0 indicates that the cross-region backup policy is disabled.

NOTICE:

Once the automated backup policy is disabled, automated backups are no longer created and all incremental backups, if any, are deleted immediately. Operations related to the incremental backups, including downloads, replications, restorations, and rebuilds, may fail.

destination_region

Yes

String

Specifies the target region ID for the cross-region backup policy.

destination_project_id

Yes

String

Specifies the target project ID for the cross-region backup policy.

Example Request

  • Configure a cross-region automated full backup policy for an RDS for MySQL or RDS for PostgreSQL DB instance.
    PUT https://{endpoint}/v3/0483b6b16e954cb88930a360d2c4e663/instances/dsfae23fsfdsae3435in01/backups/offsite-policy
    
    {
    	"policy_para": {
                    "backup_type": "auto",
    		"keep_days": 7,
    		"destination_region": "aaa",
    		"destination_project_id": "ba1f7fc8-3307-42a7-aa6f-42c8b9b8f85c"
    	}
    }
  • Disable the cross-region automated full backup policy for an RDS for MySQL or RDS for PostgreSQL DB instance.
    {
    	"policy_para": {
                    "backup_type": "auto",
    		"keep_days": 0,
    		"destination_region": "aaa",
    		"destination_project_id": "ba1f7fc8-3307-42a7-aa6f-42c8b9b8f85c"
    	}
    }
  • Configure a cross-region backup policy for an RDS for SQL Server DB instance.
    {
    	"policy_para": {
                    "backup_type": "all",
    		"keep_days": 7,
    		"destination_region": "aaa",
    		"destination_project_id": "ba1f7fc8-3307-42a7-aa6f-42c8b9b8f85c"
    	}
    }
  • Disable the cross-region backup policy for an RDS for SQL Server DB instance.
    {
    	"policy_para": {
                    "backup_type": "all",
    		"keep_days": 0,
    		"destination_region": "aaa",
    		"destination_project_id": "ba1f7fc8-3307-42a7-aa6f-42c8b9b8f85c"
    	}
    }

Response

Status Code

Error Code

For details, see Error Codes.