Updated on 2026-01-06 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 constraints on the original and target DB instances are as follows:
    • For RDS for MySQL and RDS for PostgreSQL, the DB engine versions of the original and target DB instances must be the same.
    • For RDS for SQL Server, the time zones of the original and target DB instances must be the same. Otherwise, data inconsistency may occur.
  • The total disk size of the target DB instance must be at least equal to that of the original DB instance.

URI

  • URI format

    POST /v3/{project_id}/instances

  • Parameter description
    Table 1 Parameters

    Parameter

    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.

Request

Table 2 Parameters

Parameter

Mandatory

Type

Description

name

Yes

String

DB instance name.

The DB instance name of the same type must be unique for the same tenant.

Range

  • RDS for MySQL: The DB instance name must be 4 to 64 characters long, start with a letter, and contain only letters (case-sensitive), digits, hyphens (-), periods (.), and underscores (_).
  • RDS for PostgreSQL and RDS for SQL Server: The DB instance name must be 4 to 64 characters long, start with a letter, and contain only letters (case-sensitive), digits, hyphens (-), and underscores (_).

password

No

String

Database password. If this parameter is not specified, you can reset the password after the instance is created.

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.

You are advised to enter a strong password to improve security, preventing security risks such as brute force cracking.

flavor_ref

Yes

String

Specification code. The value cannot be left blank.

For details, see spec_code in section Querying Database Specifications.

volume

Yes

Object

Volume information.

For details, see Table 7.

availability_zone

Yes

String

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

The value cannot be left blank. For details about how to obtain this parameter value, see Regions and Endpoints.

restore_point

Yes

Object

Restoration information.

For details, see Table 8.

datastore

No

Object

Database information. This parameter is used for RDS for SQL Server DB instances only and is mandatory for cross-version restoration to new DB instances.

For details, see Table 4.

ha

No

Object

HA configuration parameters, which are used when creating primary/standby DB instances.

For details, see Table 3.

configuration_id

No

String

Parameter template ID.

port

No

String

Database port information.

  • RDS for MySQL instances can use database ports 1024 to 65535, excluding 12017 and 33071, which are reserved for RDS system use.
  • RDS for PostgreSQL instances can use database ports 2100 to 9500.
  • RDS for SQL Server instances can use database port 1433 or ports 2100 to 9500, excluding 5355 and 5985.

If this parameter is not set, the default value is as follows:

  • RDS for MySQL: 3306
  • RDS for PostgreSQL: 5432
  • RDS for SQL Server: 1433

backup_strategy

No

Object

Advanced backup policy.

For details, see Table 6.

vpc_id

No

String

VPC ID. To obtain this parameter value, use either of the following methods:

  • Method 1: Log in to VPC console and view the VPC ID in the VPC details.
  • Method 2: See the "Querying VPCs" section in the Virtual Private Cloud API Reference.

subnet_id

No

String

Subnet ID. To obtain this parameter value, use either of the following methods:

  • Method 1: Log in to the VPC console and click the target subnet on the Subnets page. You can view the network ID on the displayed page.
  • Method 2: See the "Querying Subnets" section in the Virtual Private Cloud API Reference.

security_group_id

No

String

Security group which the DB instance belongs to. To obtain this parameter value, use either of the following methods:

  • Method 1: Log in to VPC console. Choose Access Control > Security Groups in the navigation pane on the left. On the displayed page, click the target security group. You can view the security group ID on the displayed page.
  • Method 2: See the "Querying Security Groups" section in the Virtual Private Cloud API Reference.

collation

No

String

This parameter applies only to RDS for SQL Server DB instances.

Value range: character sets queried in Querying the Available SQL Server Character Set.

Table 3 ha field data structure description

Parameter

Mandatory

Type

Description

mode

Yes

String

Primary/standby instance type. The value is Ha (case-insensitive).

replication_mode

Yes

String

Replication mode for the standby DB instance.

The value cannot be left blank.

  • RDS for MySQL: The value is async or semisync.
  • RDS for PostgreSQL: The value is async or sync.
  • RDS for SQL Server: The value is sync.
NOTE:
  • async indicates asynchronous replication.
  • semisync indicates semi-synchronous replication.
  • sync indicates synchronous replication.
Table 4 datastore field data structure description

Parameter

Mandatory

Type

Description

type

Yes

String

DB engine. Value:

SQLServer

version

Yes

String

Database version.

  • For Microsoft SQL Server, only the following editions are supported: 2017 Enterprise Edition, 2017 Standard Edition, 2017 Web Edition, 2014 Standard Edition, 2014 Enterprise Edition, 2016 Standard Edition, 2016 Enterprise Edition, 2012 Enterprise Edition, 2012 Standard Edition, 2012 Web Edition, 2008 R2 Enterprise Edition, 2008 R2 Standard Edition, 2008 R2 Web Edition, 2014 Web Edition, and 2016 Web Edition. Example value: 2014_SE

For details about supported database versions, see section Querying Version Information About a DB Engine.

Table 5 Version mapping for RDS for SQL Server restoration

Original

Restore To

2014

2014

2014

2014

2014

2016

2016

2016

2016

2016

Table 6 backup_strategy field data structure description

Parameter

Mandatory

Type

Description

start_time

Yes

String

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

The value cannot be left blank. It 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

keep_days

No

Integer

Retention days for specific backup files.

The value range is from 0 to 732. If this parameter is not specified or set to 0, the automated backup policy is disabled.

Table 7 volume field data structure description

Parameter

Mandatory

Type

Description

type

Yes

String

Storage type.

Its value can be any of the following and is case-sensitive:

  • ULTRAHIGH: ultra-high I/O
  • CLOUDSSD: cloud SSD
  • ESSD: extreme SSD

size

Yes

Integer

Storage size.

Its value range is from 40 GB to 4,000 GB. The value must be a multiple of 10.

NOTICE:

The storage of the new DB instance must be at least equal to that of the original DB instance.

Table 8 restore_point field data structure description

Parameter

Mandatory

Type

Description

instance_id

Yes

String

Instance ID.

type

Yes

String

Restoration mode. Enumerated values include:

  • backup: indicates restoration from backup files. 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.

backup_id

No

String

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

NOTICE:

When type is not mandatory, backup_id is mandatory.

restore_time

No

Integer

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

NOTICE:

When type is mandatory, restore_time is mandatory.

Example Request

  • Restore a backup to a new DB instance.
    POST https://{endpoint}/v3/0483b6b16e954cb88930a360d2c4e663/instances
    
    {
    	"name": "targetInst",
    	"availability_zone": "bbb,ccc",
    	"ha": {
    		"mode": "ha",
    		"replication_mode": "async"
    	},
    	"flavor_ref": "rds.mysql.s1.large",
    	"volume": {
    		"type": "ULTRAHIGH",
    		"size": 40
    	},
            "region": "aaa",
    	"vpc_id": "490a4a08-ef4b-44c5-94be-3051ef9e4fce",
    	"subnet_id": "0e2eda62-1d42-4d64-a9d1-4e9aa9cd994f",
    	"security_group_id": "2a1f7fc8-3307-42a7-aa6f-42c8b9b8f8c5",
    	"backup_strategy": {
    		"keep_days": 2,
    		"start_time": "19:00-20:00"
    	},
    	"password": "Demo@12345678",
    	"configuration_id": "52e86e87445847a79bf807ceda213165pr01",
    	"time_zone": "UTC+04:00",
    	"restore_point": {
    		"instance_id": "d8e6ca5a624745bcb546a227aa3ae1cfin01",
    		"type": "backup",
    		"backup_id": "2f4ddb93-b901-4b08-93d8-1d2e472f30fe"
    	}
    }
  • Restore instance data to a specific point in time.
    {
    	"name": "targetInst",
    	"availability_zone": "bbb,ccc",
    	"ha": {
    		"mode": "ha",
    		"replication_mode": "async"
    	},
    	"flavor_ref": "rds.mysql.s1.large",
    	"volume": {
    		"type": "ULTRAHIGH",
    		"size": 40
    	},
    	"vpc_id": "490a4a08-ef4b-44c5-94be-3051ef9e4fce",
    	"subnet_id": "0e2eda62-1d42-4d64-a9d1-4e9aa9cd994f",
    	"security_group_id": "2a1f7fc8-3307-42a7-aa6f-42c8b9b8f8c5",
    	"backup_strategy": {
    		"keep_days": 2,
    		"start_time": "19:00-20:00"
    	},
    	"password": "Demo@12345678",
    	"configuration_id": "52e86e87445847a79bf807ceda213165pr01",
    	"restore_point": {
    		"instance_id": "d8e6ca5a624745bcb546a227aa3ae1cfin01",
    		"type": "timestamp",
    		"restore_time": 1532001446987
    	}
    }

Response

  • Normal response
    Table 9 Parameters

    Parameter

    Type

    Description

    instance

    Object

    DB instance information.

    For details, see Table 10.

    job_id

    String

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

    Table 10 instance description

    Parameter

    Type

    Description

    id

    String

    Instance ID.

    name

    String

    DB instance name.

    The DB instance name of the same type must be unique for the same tenant.

    status

    String

    DB instance status. For example, BUILD indicates that the DB instance is being created.

    datastore

    Object

    Database information.

    For details, see Table 11.

    ha

    Object

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

    For details, see Table 12.

    configuration_id

    String

    Parameter template ID. This parameter is returned only when a custom parameter template is used during DB instance creation.

    port

    String

    Database port information.

    • RDS for MySQL instances can use database ports 1024 to 65535, excluding 12017 and 33071, which are reserved for RDS system use.
    • RDS for PostgreSQL instances can use database ports 2100 to 9500.
    • RDS for SQL Server instances can use database port 1433 or ports 2100 to 9500, excluding 5355 and 5985.

    If this parameter is not set, the default value is as follows:

    • RDS for MySQL: 3306
    • RDS for PostgreSQL: 5432
    • RDS for SQL Server: 1433

    backup_strategy

    Object

    Automated backup policy.

    For details, see Table 13.

    flavor_ref

    String

    Specification ID.

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

    volume

    Object

    Volume information.

    For details, see Table 14.

    region

    String

    Region ID.

    availability_zone

    String

    AZ ID.

    vpc_id

    String

    VPC ID. To obtain this parameter value, use either of the following methods:

    • Method 1: Log in to VPC console and view the VPC ID in the VPC details.
    • Method 2: See the "Querying VPCs" section in the Virtual Private Cloud API Reference.

    subnet_id

    String

    Subnet ID. To obtain this parameter value, use either of the following methods:

    • Method 1: Log in to the VPC console and click the target subnet on the Subnets page. You can view the network ID on the displayed page.
    • Method 2: See the "Querying Subnets" section in the Virtual Private Cloud API Reference.

    security_group_id

    String

    Security group which the DB instance belongs to. To obtain this parameter value, use either of the following methods:

    • Method 1: Log in to VPC console. Choose Access Control > Security Groups in the navigation pane on the left. On the displayed page, click the target security group. You can view the security group ID on the displayed page.
    • Method 2: See the "Querying Security Groups" section in the Virtual Private Cloud API Reference.

    collation

    String

    Collation for RDS for SQL Server.

    Table 11 datastore field data structure description

    Parameter

    Mandatory

    Type

    Description

    type

    Yes

    String

    DB engine. Its value can be any of the following and is case-insensitive:

    • MySQL
    • PostgreSQL
    • SQLServer

    version

    Yes

    String

    Database version.

    For details about supported database versions, see section Querying Version Information About a DB Engine.

    Table 12 ha field data structure description

    Parameter

    Mandatory

    Type

    Description

    mode

    Yes

    String

    Primary/standby instance type. The value is Ha.

    replication_mode

    Yes

    String

    Replication mode for the standby DB instance.

    The value cannot be left blank.

    • RDS for MySQL: The value is async or semisync.
    • RDS for PostgreSQL: The value is async or sync.
    • RDS for SQL Server: The value is sync.
    NOTE:
    • async indicates the asynchronous replication mode.
    • semisync indicates the semi-synchronous replication mode.
    • sync indicates the synchronous replication mode.
    Table 13 backupStrategy field data structure description

    Parameter

    Mandatory

    Type

    Description

    start_time

    Yes

    String

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

    The value cannot be left blank. It 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

    keep_days

    No

    Integer

    Retention days for specific backup files.

    The value range is from 0 to 732. If this parameter is not specified or set to 0, the automated backup policy is disabled.

    Table 14 volume field data structure description

    Parameter

    Mandatory

    Type

    Description

    type

    Yes

    String

    Storage type.

    Its value can be any of the following and is case-sensitive:

    • ULTRAHIGH: ultra-high I/O
    • CLOUDSSD: cloud SSD
    • ESSD: extreme SSD

    size

    Yes

    Integer

    Storage size.

    Its value range is from 40 GB to 4,000 GB. The value must be a multiple of 10.

  • Example normal response

    RDS for MySQL

    {
    	"instance": {
    		"id": "f5ffdd8b1c98434385eb001904209eacin01",
    		"name": "demoname",
    		"status": "BUILD",
    		"datastore": {
    			"type": "MySQL",
    			"version": "5.7.31"
    		},
    		"port": "3306",
    		"volume": {
    			"type": "ULTRAHIGH",
    			"size": "40"
    		},
    		"backup_strategy": {
    			"start_time": "02:00-03:00",
    			"keep_days": "7"
    		},
    		"flavor_ref": "rds.mysql.s1.large",
    		"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"
    }

    RDS for PostgreSQL

    {
    	"instance": {
    		"id": "f5ffdd8b1c98434385eb001904209eacin01",
    		"name": "demoname",
    		"status": "BUILD",
    		"datastore": {
    			"type": "PostgreSQL",
    			"version": "12.13"
    		},
    		"port": "5432",
    		"volume": {
    			"type": "ULTRAHIGH",
    			"size": "40"
    		},
    		"backup_strategy": {
    			"start_time": "02:00-03:00",
    			"keep_days": "7"
    		},
    		"flavor_ref": "rds.pg.s1.large",
    		"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"
    }

    RDS for SQL Server

    {
    	"instance": {
    		"id": "f5ffdd8b1c98434385eb001904209eacin01",
    		"name": "demoname",
    		"status": "BUILD",
    		"datastore": {
    			"type": "sqlserver",
    			"version": "2014_SE"
    		},
    		"port": "2100",
    		"volume": {
    			"type": "ULTRAHIGH",
    			"size": "40"
    		},
    		"backup_strategy": {
    			"start_time": "02:00-03:00",
    			"keep_days": "7"
    		},
    		"flavor_ref": "rds.mssql.2014.se.s3.large.2",
    		"vpc_id": "19e5d45d-70fd-4a91-87e9-b27e71c9891f",
    		"subnet_id": "bd51fb45-2dcb-4296-8783-8623bfe89bb7",
    		"security_group_id": "23fd0cd4-15dc-4d65-bdb3-8844cc291be0",
                    "charge_info": {           
                           "charge_mode": "prePaid",            
                           "period_num": 1        
                     },        
                    "collation": "Cyrillic_General_CI_AS"
    	},
    	"order_id": "CS20122919584LQ7K"
    }
  • Abnormal response

    For details, see Abnormal Request Results.

Status Code

Error Code

For details, see Error Codes.