Updated on 2024-04-11 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 backup files must be the same as that for the automated incremental backup files.
  • 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.

URI

  • URI format

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

  • Example

    https://{Endpoint}/v3/0483b6b16e954cb88930a360d2c4e663/instances/dsfae23fsfdsae3435in01/backups/offsite-policy

  • Parameter description
    Table 1 Parameter description

    Name

    Mandatory

    Description

    project_id

    Yes

    Specifies the 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

  • Parameter description
    Table 2 Parameter description

    Name

    Mandatory

    Type

    Description

    policy_para

    Yes

    Array of objects

    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.

    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.

    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.

  • Request example

    MySQL and PostgreSQL:

    Updating a cross-region automated full backup policy:
    {
    	"policy_para": {
                    "backup_type": "auto",
    		"keep_days": 7,
    		"destination_region": "eu-de",
    		"destination_project_id": "ba1f7fc8-3307-42a7-aa6f-42c8b9b8f85c"
    	}
    }

    Disabling a cross-region automated full backup policy:

    {
    	"policy_para": {
                    "backup_type": "auto",
    		"keep_days": 0,
    		"destination_region": "eu-de",
    		"destination_project_id": "ba1f7fc8-3307-42a7-aa6f-42c8b9b8f85c"
    	}
    }

Response

Status Code

Error Code

For details, see Error Codes.