Updated on 2025-12-15 GMT+08:00

Restoring Data to a New DB Instance

Function

This API is used to restore data to a new DB instance.

Constraints

  • The DB engine of the original DB instance must be the same as that of the target DB instance. For example, if the original DB instance is running MySQL, the target DB instance must also run MySQL.
  • The DB engine versions of the original and target DB instances must be the same.
  • The storage space of the target DB instance must be at least equal to that of the original DB instance.

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

    Dependencies

    rds:instance:create

    write

    -

    -

    -

    -

URI

  • URI format

    POST /v3/{project_id}/instances

  • Parameter description
    Table 1 Parameters

    Parameter

    Mandatory

    Type

    Description

    project_id

    Yes

    String

    Definition

    Project ID of a tenant in a region.

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

    Constraints

    N/A

    Range

    N/A

    Default Value

    N/A

Request

Table 2 Parameters

Parameter

Mandatory

Type

Description

name

Yes

String

Definition

Instance name.

Constraints

Instances of the same type can have the same name under the same tenant.

Range

The instance name must start with a letter and consist of 4 to 64 characters. Only letters (case-sensitive), digits, hyphens (-), underscores (_), and periods (.) are allowed.

Default Value

N/A

password

No

String

Definition

Database password.

Constraints

Enter a strong password to improve security and prevent security risks such as brute force cracking. If the password you provide is considered weak, the system will prompt you to enter a stronger one.

Range

A database password must be 8 to 32 characters long and contain at least three types of the following characters: uppercase letters, lowercase letters, digits, and special characters. The allowed special characters include ~!@#$%^*-_=+?,()&.

Default Value

N/A

flavor_ref

Yes

String

Definition

Specification code.

Constraints

N/A

Range

The value cannot be empty. For details, see spec_code in Table 3 of Querying Database Specifications.

Default Value

N/A

volume

Yes

Object

Definition

Instance storage. For details, see Table 5.

Constraints

N/A

availability_zone

Yes

String

Definition

AZ ID.

Constraints

If the DB instance is not a single-node instance, you need to specify an AZ for each node of the instance and separate the AZs with commas (,).

Range

The value cannot be empty. For details, see Regions and Endpoints.

Default Value

N/A

restore_point

Yes

Object

Definition

Restoration information. For details, see Table 6.

Constraints

N/A

ha

No

Object

Definition

HA configuration. For details, see Table 3.

Constraints

This parameter is used only when you create a primary/standby instance.

port

No

String

Definition

Database port.

Constraints

N/A

Range

  • If this parameter is not specified, the default value is 3306.
  • If this parameter is specified, the value range is from 1024 to 65535 (excluding 12017 and 33071, which are occupied by the RDS system and cannot be used).

Default Value

3306

backup_strategy

No

Object

Definition

Advanced backup policy. For details, see Table 4.

Constraints

N/A

region

No

String

Definition

Region ID.

Constraints

N/A

Range

The value cannot be empty. For details, see Regions and Endpoints.

Default Value

N/A

charge_info

Yes

Object

Definition

Yearly/Monthly billing information. For details, see Table 7.

Constraints

N/A

time_zone

No

String

Definition

UTC time zone.

Constraints

N/A

Range

  • If this parameter is not specified, the UTC time is used by default.
  • If this parameter is specified, the value range is from UTC-12:00 to UTC+12:00 on the hour. For example, the value can be UTC+08:00 rather than UTC+08:30.

Default Value

UTC+08:00

tags

No

Array of objects

Definition

Tag list. Each DB instance can be associated with tag key–value pairs while being created.

For details, see Table 8.

Constraints

If you want to create DB instances with multiple tag key–value pairs, separate them with commas (,). A maximum of 20 key–value pairs can be added for an instance.

is_flexus

Yes

boolean

Definition

Whether to create a FlexusRDS instance.

Constraints

N/A

Range

true

Default Value

N/A

Table 3 ha field data structure description

Parameter

Mandatory

Type

Description

mode

Yes

String

Definition

Instance type.

Constraints

N/A

Range

HA (case-insensitive)

Default Value

N/A

replication_mode

Yes

String

Definition

Replication mode for the standby instance.

Constraints

N/A

Range

  • async: asynchronous replication
  • semisync: semi-synchronous replication

Default Value

N/A

Table 4 backup_strategy field data structure description

Parameter

Mandatory

Type

Description

start_time

Yes

String

Definition

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

Constraints

N/A

Range

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

  • 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 00, 15, 30, or 45.

Example:

  • 08:15-09:15
  • 23:00-00:00

Default Value

N/A

keep_days

No

Integer

Definition

Retention days for backups.

Constraints

N/A

Range

  • If this parameter is not specified, the default value 7 is used.
  • If this parameter is specified, the value range is from 0 to 732. 0 indicates that the automated backup policy is disabled. To extend the retention period, contact customer service. Automated backups can be retained for up to 2,562 days.

Default Value

7

Table 5 volume field data structure description

Parameter

Mandatory

Type

Description

type

Yes

String

Definition

Storage type.

Constraints

N/A

Range

CLOUDSSD (case-sensitive): cloud SSD storage. This storage type is supported only with general-purpose and dedicated instances.

Default Value

N/A

size

Yes

Integer

Definition

Storage space.

Constraints

The storage space of the new DB instance must be greater than or equal to that of the original DB instance.

Range

40–4000, in GB. The value must be a multiple of 10.

Default Value

N/A

Table 6 restore_point field data structure description

Parameter

Mandatory

Type

Description

instance_id

Yes

String

Definition

Instance ID.

Constraints

N/A

Range

N/A

Default Value

N/A

type

Yes

String

Definition

Restoration mode.

Constraints

N/A

Range

  • backup: indicates restoration from backups. In this mode, backup_id is mandatory when type is not mandatory.
  • timestamp: indicates point-in-time restoration. In this mode, restore_time is mandatory when type is mandatory.

Default Value

N/A

backup_id

No

String

Definition

ID of the backup used to restore data. This parameter must be specified when backups are used for restoration.

Constraints

When type is not mandatory, backup_id is mandatory.

Range

N/A

Default Value

N/A

restore_time

No

Integer

Definition

Time point of data restoration in the UNIX timestamp format. The unit is millisecond and the time zone is UTC.

Constraints

When type is mandatory, restore_time is mandatory.

Range

N/A

Default Value

N/A

Table 7 charge_info field data structure description

Parameter

Mandatory

Type

Description

charge_mode

Yes

String

Definition

Billing mode.

Constraints

N/A

Range

prePaid: yearly/monthly billing

Default Value

N/A

period_type

Yes

String

Definition

Subscription type.

Constraints

N/A

Range

  • month: monthly subscription.
  • year: yearly subscription.

Default Value

N/A

period_num

No

Integer

Definition

Subscription period.

Constraints

N/A

Range

  • When period_type is set to month, the parameter value ranges from 1 to 9.
  • When period_type is set to year, the parameter value ranges from 1 to 3.

Default Value

N/A

is_auto_renew

No

boolean

Definition

Whether automatic renewal is enabled for yearly/monthly instances. The renewal period is the same as the original period, and the order will be automatically paid.

Constraints

N/A

Range

  • true: indicates that automatic renewal is enabled.
  • false: indicates that automatic renewal is disabled. The default value is false.

Default Value

false

is_auto_pay

No

boolean

Definition

Whether the order will be automatically paid. This parameter does not affect the payment method of automatic renewal.

Constraints

N/A

Range

  • true: indicates the order will be automatically paid.
  • false: indicates the order will be manually paid. The default value is false.

Default Value

false

Table 8 tags field data structure description

Parameter

Mandatory

Type

Description

key

Yes

String

Definition

Tag key.

Constraints

N/A

Range

The value must consist of 1 to 128 Unicode characters.

It can contain letters, digits, spaces, and special characters _.:=+-@. However, it cannot start or end with a space, or start with _sys_.

Default Value

N/A

value

Yes

String

Definition

Tag value.

Constraints

N/A

Range

It can be left blank or contain a maximum of 255 Unicode characters.

It can contain letters, digits, spaces, and special characters _.:=+-@.

Default Value

N/A

Example Request

  • Restore data to a new instance from FlexusRDS backups.
    POST https://{endpoint}/v3/0483b6b16e954cb88930a360d2c4e663/instances
    {
    	"name": "targetInst",
    	"availability_zone": "bbb,ccc",
    	"ha": {
    		"mode": "ha",
    		"replication_mode": "async"
    	},
    	"flavor_ref": "rds.mysql.y1.xlarge.2.ha",
    	"volume": {
    		"type": "CLOUDSSD",
    		"size": 40
    	},
            "region": "aaa",
    	"backup_strategy": {
    		"keep_days": 2,
    		"start_time": "19:00-20:00"
    	},
    	"password": "Demo@12345678",
    	"time_zone": "UTC+04:00",
    	"restore_point": {
    		"instance_id": "d8e6ca5a624745bcb546a227aa3ae1cfin01",
    		"type": "backup",
    		"backup_id": "2f4ddb93-b901-4b08-93d8-1d2e472f30fe"
    	}
    }
  • Restore data of a FlexusRDS instance to a specific point in time.
    {
    	"name": "targetInst",
    	"availability_zone": "bbb,ccc",
    	"ha": {
    		"mode": "ha",
    		"replication_mode": "async"
    	},
    	"flavor_ref": "rds.mysql.y1.xlarge.2.ha",
    	"volume": {
    		"type": "CLOUDSSD",
    		"size": 40
    	},
    	"backup_strategy": {
    		"keep_days": 2,
    		"start_time": "19:00-20:00"
    	},
    	"password": "Demo@12345678",
    	"time_zone": "UTC+04:00",
    	"restore_point": {
    		"instance_id": "d8e6ca5a624745bcb546a227aa3ae1cfin01",
    		"type": "timestamp",
    		"restore_time": 1532001446987
    	}
    }

Response

  • Normal response
    Table 9 Parameters

    Parameter

    Type

    Description

    instance

    Object

    Definition

    Instance information. For details, see Table 10.

    job_id

    String

    Definition

    Instance creation task ID. This parameter is returned only for the restoration to a new DB instance billed on the pay-per-use basis.

    Range

    N/A

    Table 10 instance description

    Parameter

    Type

    Description

    id

    String

    Definition

    Instance ID.

    Range

    N/A

    name

    String

    Definition

    Instance name. Instances of the same type can have the same name under the same tenant.

    Range

    The value is the same as that of the corresponding request parameter.

    status

    String

    Definition

    Instance status.

    Range

    BUILD: indicates that the instance is being created.

    datastore

    Object

    Definition

    Database information. For details, see Table 11.

    ha

    Object

    Definition

    HA configuration. This parameter is returned only when primary/standby instances are created.

    For details, see Table 12.

    port

    String

    Definition

    Database port.

    Range

    The value is the same as that of the corresponding request parameter.

    backup_strategy

    Object

    Definition

    Automated backup policy. For details, see Table 13.

    flavor_ref

    String

    Definition

    Specification ID. For details, see spec_code in Table 3 of Querying Database Specifications.

    volume

    Object

    Definition

    Volume information. For details, see Table 14.

    region

    String

    Definition

    Region ID.

    Range

    The value is the same as that of the corresponding request parameter.

    availability_zone

    String

    Definition

    AZ ID.

    Range

    The value is the same as that of the corresponding request parameter.

    vpc_id

    String

    Definition

    VPC ID.

    Range

    vpc-default-smb

    subnet_id

    String

    Definition

    Subnet ID.

    Range

    subnet-default-smb

    security_group_id

    String

    Definition

    Security group which the instance is associated with.

    Range

    sg-default-smb

    charge_info

    Object

    Definition

    Billing information. For details, see Table 7.

    Table 11 datastore field data structure description

    Parameter

    Mandatory

    Type

    Description

    type

    Yes

    String

    Definition

    DB engine.

    Range

    MySQL

    version

    Yes

    String

    Definition

    DB engine version.

    Range

    5.7 or 8.0

    Table 12 ha field data structure description

    Parameter

    Mandatory

    Type

    Description

    mode

    Yes

    String

    Definition

    Instance type.

    Range

    HA (case-insensitive)

    replication_mode

    Yes

    String

    Definition

    Replication mode for the standby instance.

    Range

    • async: asynchronous replication
    • semisync: semi-synchronous replication
    Table 13 backupStrategy field data structure description

    Parameter

    Mandatory

    Type

    Description

    start_time

    Yes

    String

    Definition

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

    Range

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

    • 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 00, 15, 30, or 45.

    Example:

    • 08:15-09:15
    • 23:00-00:00

    If backup_strategy in the request body is empty, 02:00-03:00 is returned for start_time by default.

    keep_days

    No

    Integer

    Definition

    Retention days for backups.

    Range

    0–732. 0 indicates that the automated backup policy is disabled. To extend the retention period, contact customer service. Automated backups can be retained for up to 2,562 days.

    If backup_strategy in the request body is empty, 7 is returned for keep_days by default.

    Table 14 volume field data structure description

    Parameter

    Mandatory

    Type

    Description

    type

    Yes

    String

    Definition

    Storage type.

    Range

    CLOUDSSD (case-sensitive): cloud SSD storage. This storage type is supported only with general-purpose and dedicated instances.

    size

    Yes

    Integer

    Definition

    Storage space.

    Range

    40–4000, in GB. The value must be a multiple of 10.

    The values of region and availability_zone in the example response are only for reference.

  • Example normal response

    Restore data to a new instance from FlexusRDS backups.

    {
    	"instance": {
    		"id": "f5ffdd8b1c98434385eb001904209eacin01",
    		"name": "demoname",
    		"status": "BUILD",
    		"datastore": {
    			"type": "MySQL",
    			"version": "5.7.31"
    		},
    		"port": "3306",
    		"volume": {
    			"type": "ULTRAHIGH",
    			"size": "40"
    		},
    		"region": "aaa",
    		"backup_strategy": {
    			"start_time": "02:00-03:00",
    			"keep_days": "7"
    		},
    		"flavor_ref": "rds.mysql.s1.large",
    		"availability_zone": "bbb",
    		"vpc_id": "19e5d45d-70fd-4a91-87e9-b27e71c9891f",
    		"subnet_id": "bd51fb45-2dcb-4296-8783-8623bfe89bb7",
    		"security_group_id": "23fd0cd4-15dc-4d65-bdb3-8844cc291be0"
    	},
    	"job_id": "bf003379-afea-4aa5-aa83-4543542070bc"
    }
  • Abnormal response

    For details, see Abnormal Request Results.

Status Code