Changing a VPC for an ECS
Function
This API is used to change a VPC for an ECS.
This API is an asynchronous API. After the VPC change request is successfully delivered, job_id is returned. This does not mean the VPC change is complete. You need to call the API by referring to Querying Task Execution Status to query the job status. The SUCCESS status indicates that the change is successful.
Changing the VPC will detach the primary NIC from the ECS. Then, create a new primary NIC for the ECS in the changed VPC.
If the original primary NIC has an EIP bound, after the VPC is changed, this EIP will be bound to the new primary NIC.
- Changing the VPC will interrupt ECS network connections and change the subnet, IP address, and MAC address of the ECS.
- After the VPC is changed, you are required to reconfigure network-related application software and services, such as ELB, VPN, NAT, and DNS.
- During the change process, do not perform operations on the ECS, including its EIP.
Constraints
- The VPC of an ECS can be changed if the ECS has the primary NIC only.
- The VPC of an ECS cannot be changed if the ECS has an IPv6 NIC added.
URI
POST /v1/{project_id}/cloudservers/{server_id}/changevpc
Parameter |
Mandatory |
Description |
---|---|---|
project_id |
Yes |
Specifies the project ID. For details about how to obtain the ID, see Obtaining a Project ID. |
server_id |
Yes |
Specifies the ECS ID. |
Request
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
vpc_id |
Yes |
String |
Specifies the VPC ID in UUID format. |
nic |
Yes |
Object |
Specifies the NICs to be added. For details, see Table 3. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
port_id |
No |
String |
Specifies the NIC ID in UUID format. If this parameter is not left blank, the specified NIC is attached.
NOTE:
Either port_id or subnet_id must be specified. You can obtain the NIC ID by querying the ports for accessing VPCs. Note:
|
subnet_id |
No |
String |
Specifies the information about the NICs to be added to an ECS. Set the parameter value to the ID (in UUID format) of the network created in the VPC to which the target ECS belongs. |
security_groups |
No |
Array of objects |
Specifies the security groups for NICs. For details, see Table 4. |
ip_address |
No |
String |
Specifies the IP address. If this parameter is left blank, the IP address is automatically assigned. |
Response
See Responses (Task).
Example Request
Change a VPC, add a NIC, select a security group, and specify an IP address for an ECS.
POST https://{endpoint}/v1/{project_id}/cloudservers/{server_id}/changevpc { "vpc_id": "d32019d3-bc6e-4319-9c1d-6722fc136a23", "nic": { "subnet_id": "d32019d3-bc6e-4319-9c1d-6722fc136a23", "security_groups": [ { "id": "f0ac4394-7e4a-4409-9701-ba8be283dbc3" } ], "ip_address": "192.168.255.1" } }
Example Response
{ "job_id": "ff8080829029501f01902e4a1703000f" }
Returned Values
Error Codes
See Error 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