Creating a Protected Instance
Function
This API is used to create a protected instance. When a protected instance is created, the default name of the server at the DR site is the same as that of the server at the production site, but their IDs are different. To modify a server name, click the server name on the protected instance details page to switch to the server details page and modify the server name. Alternatively, you can call the API in Changing the Name of a Protected Instance to modify the name.
Constraints and Limitations
- status of the protection group must be available or protected.
- Shared disks cannot be attached to a production site server. If you want to use a server with shared disks attached to create a protected instance, use the API of creating protected instances in batches.
- One server can be used to create only one protected instance.
- The server must be in the same VPC as the protection group.
- If protection is enabled for servers created during capacity expansion of an Auto Scaling (AS) group, these servers cannot be deleted when the capacity of the AS group is reduced.
- If the server at the production site runs Windows and you choose the key login mode, ensure that the key pair of the server exists when you create a protected instance. Otherwise, the server at the DR site may fail to create, causing the protected instance creation failure.
If the key pair of the production site server has been deleted, create a key pair with the same name.
- If the production site server is added to Enterprise Project, the created DR site server will not be automatically added to Enterprise Project. You need to manually add it to Enterprise Project if needed.
- After you create a protected instance and enable protection on servers at the production site, modifications to the Hostname, Name, Security Group, Agency, ECS Group, Tags, and Auto Recovery configurations of servers on the production site will not synchronize to the servers at the DR site. You can manually add the configuration items to the servers at the DR site on the management console.
- If a production site server has been added to an ECS group, you are not allowed to specify a DeH to create the DR site server for the production site server.
URI
- URI format
- Parameter description
Parameter
Mandatory
Type
Description
project_id
Yes
String
Specifies the project ID.
For details about how to obtain the project ID, see Obtaining a Project ID.
Request
- Parameter description
Parameter
Mandatory
Type
Description
protected_instance
Yes
Object
Specifies the information about a protected instance.
For details, see Table 1.
Table 1 protected_instance field description Parameter
Mandatory
Type
Description
server_group_id
Yes
String
Specifies the ID of the protection group where a protected instance is added.
For details, see Querying Protection Groups.
server_id
Yes
String
Specifies the ID of the production site server.
NOTE:When the API is successfully invoked, the DR site server will be automatically created.
name
Yes
String
Specifies the name of a protected instance. The name can contain a maximum of 64 bytes. The value can contain only letters (a to z and A to Z), digits (0 to 9), decimal points (.), underscores (_), and hyphens (-).
description
No
String
Specifies the description of a protected instance. The description can contain a maximum of 64 bytes. The value cannot contain the left angle bracket (<) or right angle bracket (>).
cluster_id
No
String
Specifies the DSS storage pool ID.
This parameter needs to be specified if the DR site disk uses DSS.
primary_subnet_id
No
String
Specifies the network ID of the subnet for the primary NIC on the DR site server. The value is the same as that of neutron_network_id obtained using the VPC API.
primary_ip_address
No
String
Specifies the IP address of the primary NIC on the DR site server.
This parameter is valid only when primary_subnet_id is specified.
If this parameter is not specified when primary_subnet_id is specified, the system automatically assigns an IP address to the primary NIC on the DR site server
flavorRef
No
String
Specifies the flavor ID of the DR site server
NOTE:- If this parameter is not specified, the flavor ID of the DR site server is the same as that of the production site server by default.
- Servers of different specifications have different performance, which may affect applications running on the servers. To ensure the server performance after a planned failover or failover, you are recommended to use servers of specifications (CPU and memory) same or higher than the specifications of the production site servers at the DR site.
tenancy
No
String
Specifies whether the DR site server is created on a Dedicated Host (DeH) or in a shared pool.
The value can be shared or dedicated.
shared: indicates the shared pool.
dedicated: indicates the DeH.
dedicated_host_id
No
String
Specifies the DeH ID. This parameter takes effect only when tenancy is set to dedicated.
If you do not specify this parameter, the system will automatically assign a DeH to a tenant to deploy servers.
tags
No
Array of objects
Specifies the tag list.
For details, see Table 2.
NOTE:You can add up to 10 tags for each protected instance.
Table 2 resource_tag field description Parameter
Mandatory
Type
Description
key
Yes
String
Specifies the tag key. The tag key of a resource must be unique.
It can contain up to 36 Unicode characters. The tag key cannot be left blank or be an empty string. It cannot contain non-printable ASCII characters (0–31) or special characters, including asterisks (*), left angle brackets (<), right angle brackets (>), backslashes (\), equal signs (=), commas (,), vertical bars (|), and slashes (/). The tag key of a resource must be unique.
value
Yes
String
Specifies the value.
It can contain up to 43 Unicode characters. The value cannot be left blank but can be an empty string. It cannot contain non-printable ASCII characters (0–31) or special characters, including asterisks (*), left angle brackets (<), right angle brackets (>), backslashes (\), equal signs (=), commas (,), vertical bars (|), and slashes (/).
- Example request
POST https://{Endpoint}/v1/{project_id}/protected-instances
{ "protected_instance":{ "server_group_id": "523ab8ad-3759-4933-9436-4cf4ebb20867", "server_id": "403b603d-1d91-42cc-a357-81f3c2daf43f", "name": "test_protected_instance_name", "description": "my description", "primary_subnet_id": "a32217fh-3413-c313-6342-3124d3491502", "primary_ip_address": "192.168.0.5", "flavorRef": "s3.large.2", "tenancy": "dedicated", "dedicated_host_id": "0bc41598-1b5a-4bd2-872a-82e6abb82e68", } }
Response
- Parameter description
Parameter
Type
Description
job_id
String
Specifies the returned parameter when the asynchronous API command is issued successfully. For details about the task execution result, see the description in Querying the Job Status.
- Example response
{ "job_id": "0000000062db92d70162db9d200f00bb" }
Or
{ "error": { "message": "XXXX", "code": "XXX" } }
In this example, error represents a general error, including badrequest (shown below) and itemNotFound.
{ "badrequest": { "message": "XXXX", "code": "XXX" } }
Returned Values
- Normal
Returned Value
Description
200
The server has accepted the request.
- Abnormal
Returned Value
Description
400 Bad Request
The server failed to process the request.
401 Unauthorized
You must enter a username and the password to access the requested page.
403 Forbidden
You are forbidden to access the requested page.
404 Not Found
The server could not find the requested page.
405 Method Not Allowed
You are not allowed to use the method specified in the request.
406 Not Acceptable
The response generated by the server could not be accepted by the client.
407 Proxy Authentication Required
You must use the proxy server for authentication so that the request can be processed.
408 Request Timeout
The request timed out.
409 Conflict
The request could not be processed due to a conflict.
500 Internal Server Error
Failed to complete the request because of a service error.
501 Not Implemented
Failed to complete the request because the server does not support the requested function.
502 Bad Gateway
Failed to complete the request because the server receives an invalid response from an upstream server.
503 Service Unavailable
Failed to complete the request because the system is unavailable.
504 Gateway Timeout
A gateway timeout error occurred.
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