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
Situation Awareness
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

Changing a VPC for an ECS

Updated on 2024-12-19 GMT+08:00

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.

NOTE:
  • 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

Table 1 describes the parameters in the URI.
Table 1 Parameter description

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

Table 2 describes the request parameters.
Table 2 Request parameters

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.

Table 3 nic field description

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:

  • The NIC must be in a security group.
  • The NIC must be in DOWN state.
  • The VPC ID of the NIC must be the same as the specified VPC ID.
  • If both port_id and subnet_id are specified, port_id is used preferentially.
  • If port_id is specified, a network interface is used. In such a case, security_groups and ip_address do not take effect.

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.

Table 4 security_groups field description

Parameter

Mandatory

Type

Description

id

Yes

String

Specifies the ID of the security group.

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"
}

Error Codes

See Error Codes.

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