Compute
Elastic Cloud Server
Huawei Cloud Flexus
Bare Metal Server
Auto Scaling
Image Management Service
Dedicated Host
FunctionGraph
Cloud Phone Host
Huawei Cloud EulerOS
Networking
Virtual Private Cloud
Elastic IP
Elastic Load Balance
NAT Gateway
Direct Connect
Virtual Private Network
VPC Endpoint
Cloud Connect
Enterprise Router
Enterprise Switch
Global Accelerator
Management & Governance
Cloud Eye
Identity and Access Management
Cloud Trace Service
Resource Formation Service
Tag Management Service
Log Tank Service
Config
OneAccess
Resource Access Manager
Simple Message Notification
Application Performance Management
Application Operations Management
Organizations
Optimization Advisor
IAM Identity Center
Cloud Operations Center
Resource Governance Center
Migration
Server Migration Service
Object Storage Migration Service
Cloud Data Migration
Migration Center
Cloud Ecosystem
KooGallery
Partner Center
User Support
My Account
Billing Center
Cost Center
Resource Center
Enterprise Management
Service Tickets
HUAWEI CLOUD (International) FAQs
ICP Filing
Support Plans
My Credentials
Customer Operation Capabilities
Partner Support Plans
Professional Services
Analytics
MapReduce Service
Data Lake Insight
CloudTable Service
Cloud Search Service
Data Lake Visualization
Data Ingestion Service
GaussDB(DWS)
DataArts Studio
Data Lake Factory
DataArts Lake Formation
IoT
IoT Device Access
Others
Product Pricing Details
System Permissions
Console Quick Start
Common FAQs
Instructions for Associating with a HUAWEI CLOUD Partner
Message Center
Security & Compliance
Security Technologies and Applications
Web Application Firewall
Host Security Service
Cloud Firewall
SecMaster
Anti-DDoS Service
Data Encryption Workshop
Database Security Service
Cloud Bastion Host
Data Security Center
Cloud Certificate Manager
Edge Security
Managed Threat Detection
Blockchain
Blockchain Service
Web3 Node Engine Service
Media Services
Media Processing Center
Video On Demand
Live
SparkRTC
MetaStudio
Storage
Object Storage Service
Elastic Volume Service
Cloud Backup and Recovery
Storage Disaster Recovery Service
Scalable File Service Turbo
Scalable File Service
Volume Backup Service
Cloud Server Backup Service
Data Express Service
Dedicated Distributed Storage Service
Containers
Cloud Container Engine
SoftWare Repository for Container
Application Service Mesh
Ubiquitous Cloud Native Service
Cloud Container Instance
Databases
Relational Database Service
Document Database Service
Data Admin Service
Data Replication Service
GeminiDB
GaussDB
Distributed Database Middleware
Database and Application Migration UGO
TaurusDB
Middleware
Distributed Cache Service
API Gateway
Distributed Message Service for Kafka
Distributed Message Service for RabbitMQ
Distributed Message Service for RocketMQ
Cloud Service Engine
Multi-Site High Availability Service
EventGrid
Dedicated Cloud
Dedicated Computing Cluster
Business Applications
Workspace
ROMA Connect
Message & SMS
Domain Name Service
Edge Data Center Management
Meeting
AI
Face Recognition Service
Graph Engine Service
Content Moderation
Image Recognition
Optical Character Recognition
ModelArts
ImageSearch
Conversational Bot Service
Speech Interaction Service
Huawei HiLens
Video Intelligent Analysis Service
Developer Tools
SDK Developer Guide
API Request Signing Guide
Terraform
Koo Command Line Interface
Content Delivery & Edge Computing
Content Delivery Network
Intelligent EdgeFabric
CloudPond
Intelligent EdgeCloud
Solutions
SAP Cloud
High Performance Computing
Developer Services
ServiceStage
CodeArts
CodeArts PerfTest
CodeArts Req
CodeArts Pipeline
CodeArts Build
CodeArts Deploy
CodeArts Artifact
CodeArts TestPlan
CodeArts Check
CodeArts Repo
Cloud Application Engine
MacroVerse aPaaS
KooMessage
KooPhone
KooDrive

Restoring Data to a New DB Instance

Updated on 2024-09-04 GMT+08:00

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.

URI

  • URI format

    POST /v3/{project_id}/instances

  • Parameter description
    Table 1 Parameters

    Parameter

    Mandatory

    Type

    Description

    project_id

    Yes

    String

    Explanation:

    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

    Value range:

    N/A

    Default value:

    N/A

Request

Table 2 Parameters

Parameter

Mandatory

Type

Description

name

Yes

String

Explanation:

Instance name.

Constraints:

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

Value 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

Explanation:

Database password.

Constraints:

You are advised to enter a strong password to improve security, preventing security risks such as brute force cracking. If the password you provide is regarded as a weak password by the system, you will be prompted to enter a stronger password.

Value 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

Explanation:

Specification code.

Constraints:

N/A

Value 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

Explanation:

Instance storage. For details, see Table 5.

Constraints:

N/A

availability_zone

Yes

String

Explanation:

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 (,).

Value range:

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

Default value:

N/A

restore_point

Yes

Object

Explanation:

Restoration information. For details, see Table 6.

Constraints:

N/A

ha

No

Object

Explanation:

HA configuration. For details, see Table 3.

Constraints:

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

port

No

String

Explanation:

Database port.

Constraints:

N/A

Value 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

Explanation:

Advanced backup policy. For details, see Table 4.

Constraints:

N/A

region

No

String

Explanation:

Region ID.

Constraints:

N/A

Value range:

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

Default value:

N/A

charge_info

Yes

Object

Explanation:

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

Constraints:

N/A

time_zone

No

String

Explanation:

UTC time zone.

Constraints:

N/A

Value 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

Explanation:

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

Explanation:

Whether to create a FlexusRDS instance.

Constraints:

N/A

Value range:

true

Default value:

N/A

Table 3 ha field data structure description

Parameter

Mandatory

Type

Description

mode

Yes

String

Explanation:

Instance type.

Constraints:

N/A

Value range:

HA (case-insensitive)

Default value:

N/A

replication_mode

Yes

String

Explanation:

Replication mode for the standby instance.

Constraints:

N/A

Value 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

Explanation:

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

Constraints:

N/A

Value 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

Explanation:

Retention days for backups.

Constraints:

N/A

Value 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

Explanation:

Storage type.

Constraints:

N/A

Value 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

Explanation:

Storage space.

Constraints:

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

Value 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

Explanation:

Instance ID.

Constraints:

N/A

Value range:

N/A

Default value:

N/A

type

Yes

String

Explanation:

Restoration mode.

Constraints:

N/A

Value 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

Explanation:

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.

Value range:

N/A

Default value:

N/A

restore_time

No

Integer

Explanation:

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.

Value range:

N/A

Default value:

N/A

Table 7 charge_info field data structure description

Parameter

Mandatory

Type

Description

charge_mode

Yes

String

Explanation:

Billing mode.

Constraints:

N/A

Value range:

prePaid: yearly/monthly billing

Default value:

N/A

period_type

Yes

String

Explanation:

Subscription type.

Constraints:

N/A

Value range:

  • month: indicates that the service is subscribed by month.
  • year: indicates that the service is subscribed by year.

Default value:

N/A

period_num

No

Integer

Explanation:

Subscription period.

Constraints:

N/A

Value 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

Explanation:

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

Value 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

Explanation:

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

Constraints:

N/A

Value 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

Explanation:

Tag key.

Constraints:

N/A

Value 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

Explanation:

Tag value.

Constraints:

N/A

Value 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

    Explanation:

    Instance information. For details, see Table 10.

    job_id

    String

    Explanation:

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

    Value range:

    N/A

    Table 10 instance description

    Parameter

    Type

    Description

    id

    String

    Explanation:

    Instance ID.

    Value range:

    N/A

    name

    String

    Explanation:

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

    Value range:

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

    status

    String

    Explanation:

    Instance status.

    Value range:

    BUILD: indicates that the instance is being created.

    datastore

    Object

    Explanation:

    Database information. For details, see Table 11.

    ha

    Object

    Explanation:

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

    For details, see Table 12.

    port

    String

    Explanation:

    Database port.

    Value range:

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

    backup_strategy

    Object

    Explanation:

    Automated backup policy. For details, see Table 13.

    flavor_ref

    String

    Explanation:

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

    volume

    Object

    Explanation:

    Volume information. For details, see Table 14.

    region

    String

    Explanation:

    Region ID.

    Value range:

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

    availability_zone

    String

    Explanation:

    AZ ID.

    Value range:

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

    vpc_id

    String

    Explanation:

    VPC ID.

    Value range:

    vpc-default-smb

    subnet_id

    String

    Explanation:

    Subnet ID.

    Value range:

    subnet-default-smb

    security_group_id

    String

    Explanation:

    Security group which the instance is associated with.

    Value range:

    sg-default-smb

    charge_info

    Object

    Explanation:

    Billing information. For details, see Table 7.

    Table 11 datastore field data structure description

    Parameter

    Mandatory

    Type

    Description

    type

    Yes

    String

    Explanation:

    DB engine.

    Value range:

    MySQL

    version

    Yes

    String

    Explanation:

    DB engine version.

    Value range:

    5.7 or 8.0

    Table 12 ha field data structure description

    Parameter

    Mandatory

    Type

    Description

    mode

    Yes

    String

    Explanation:

    Instance type.

    Value range:

    HA (case-insensitive)

    replication_mode

    Yes

    String

    Explanation:

    Replication mode for the standby instance.

    Value range:

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

    Parameter

    Mandatory

    Type

    Description

    start_time

    Yes

    String

    Explanation:

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

    Value 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

    Explanation:

    Retention days for backups.

    Value 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

    Explanation:

    Storage type.

    Value range:

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

    size

    Yes

    Integer

    Explanation:

    Storage space.

    Value range:

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

    NOTE:

    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

We use cookies to improve our site and your experience. By continuing to browse our site you accept our cookie policy. Find out more

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback