Deletes a VSwitch from a VPC.
Before you begin
When you call this API action, note the following:
- Before deleting a VSwitch, you must delete all resources in the VSwitch, including ECS instances, SLB instances, and RDS instances.
- If the VSwitch is configured with SNAT entries or HaVips, make sure that the associated resources have been deleted.
- You can only delete the VSwitches that are in the available state.
- A VSwitch cannot be deleted if another VSwitch or a route entry is being created or deleted in the corresponding VPC.
Make the API call
Request parameters
Parameter | Type | Required? | Example value | Description |
---|---|---|---|---|
Action | String | Yes | DeleteVSwitch |
The name of this action. Value: DeleteVSwitch. |
RegionId | String | Yes | cn-hangzhou |
The ID of the region to which the target VSwitch belongs. |
VSwitchId | String | Yes | vsw-asdfjcdvflna**** |
The ID of the VSwitch to be deleted. |
Response parameters
Parameter | Type | Example value | Description |
---|---|---|---|
RequestId | String | 0ED8D006-F706-4D23-88ED-E11ED28DCAC0 |
The ID of the request. |
Examples
Request example
http(s)://vpc.aliyuncs.com/? Action=DeleteVSwitch
&VSwitchId=vsw-asdfjcdvflna****
&<CommonParameters>
Response example
XML
format
<DeleteVSwitchResponse>
<RequestId>0ED8D006-F706-4D23-88ED-E11ED28DCAC0</RequestId>
</DeleteVSwitchResponse>
JSON
format
{
"RequestId":"0ED8D006-F706-4D23-88ED-E11ED28DCAC0"
}
Errors
HTTP status code | Error code | Error message | Description |
---|---|---|---|
400 | IncorrectVSwitchStatus | The current virtual switch status does not support this operation. | The specified VSwitch is in the pending state and cannot be deleted. |
400 | DependencyViolation | Specified object has dependent resources. | The specified VSwitch cannot be deleted because not all resources under the specified VSwitch have been released. |
400 | DependencyViolation | Some route entry status blocked this operation. | You cannot perform this operation because one or more route entries in the current route table are in the pending or modifying state. |
400 | IncorrectRouteEntryStatus | Some route entry status blocked this operation. | You cannot perform this operation because one or more route entries in the current route table are in the pending or modifying state. |
400 | DependencyViolation.HaVip | VSwitch cannot be deleted when there are some HaVip dependent with it. | The specified VSwitch cannot be deleted because it has an associated HaVip. |
400 | MissingParameter | Miss mandatory parameter. | One or more mandatory parameters are missing. |
404 | InvalidVSwitchId.NotFound | VSwitch not exist. | The specified VSwitch does not exist. |
404 | IncorrectStatus | Vswtich status not stable. | The specified VSwitch is in the pending or modifying state. |
For a list of error codes, visit the API Error Center.