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.
URI
- URI format
- 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
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:
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:
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 |
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:
Default value: N/A |
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.
Example:
Default value: N/A |
keep_days |
No |
Integer |
Explanation: Retention days for backups. Constraints: N/A Value range:
Default value: 7 |
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 |
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:
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 |
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:
Default value: N/A |
period_num |
No |
Integer |
Explanation: Subscription period. Constraints: N/A Value range:
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:
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:
Default value: false |
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.
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
- Normal
- Abnormal
For details, see Status Codes.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot