• Relational Database Service

rds
  1. Help Center
  2. Relational Database Service
  3. API Reference
  4. API v3 (Recommended)
  5. Backup and Restoration
  6. Setting an Automated Backup Policy

Setting an Automated Backup Policy

Function

This API is used to set an automated backup policy.

URI

  • URI format

    PATH: /{version_id}/{project_id}/instances/{instance_id}/backups/policy

    Method: PUT

  • Parameter description
    Table 1 Parameter description

    Name

    Mandatory

    Description

    version_id

    Yes

    Specifies the API version. It is case-sensitive and the value is v3.

    project_id

    Yes

    Specifies the project ID of a tenant in a region.

    instance_id

    Yes

    Specifies the DB instance ID.

Request

  • Parameter description
    Table 2 Parameter description

    Name

    Mandatory

    Type

    Description

    backup_policy

    Yes

    Dictionary data structure

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

    For details, see Table 3.

    Table 3 backup_policy field data structure description

    Name

    Mandatory

    Type

    Description

    keep_days

    Yes

    Int

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

    The value range is from 0 to 732. The value 0 indicates that the automated backup policy is disabled.

    start_time

    No

    String

    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.

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

    • 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

    period

    No

    String

    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.

    Value range: The value is a number separated by commas (,). The number indicates the week. Example value: 1,2,3,4

  • Request example

    Modifying the automated backup policy:

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

    Disabling the automated backup policy:

    {
    	"backup_policy": {
    		"keep_days": 0
    	}
    }

Normal Response

None

Abnormal Response

For details, see Abnormal Request Results.