All Products
Search
Document Center

Elastic Compute Service:CreateVSwitch

Last Updated:Jul 07, 2026

CreateVSwitch

Note

This API has been deprecated. We recommend migrating to Vpc(2016-04-28) - CreateVSwitch for enhanced functionality and continued support. While the deprecated API remains temporarily accessible, no further updates or bug fixes will be provided.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

The table below describes the authorization required to call this API. You can define it in a Resource Access Management (RAM) policy. The table's columns are detailed below:

  • Action: The actions can be used in the Action element of RAM permission policy statements to grant permissions to perform the operation.

  • API: The API that you can call to perform the action.

  • Access level: The predefined level of access granted for each API. Valid values: create, list, get, update, and delete.

  • Resource type: The type of the resource that supports authorization to perform the action. It indicates if the action supports resource-level permission. The specified resource must be compatible with the action. Otherwise, the policy will be ineffective.

    • For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the Resource element of the policy.

    • For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (*) in the Resource element of the policy.

  • Condition key: The condition keys defined by the service. The key allows for granular control, applying to either actions alone or actions associated with specific resources. In addition to service-specific condition keys, Alibaba Cloud provides a set of common condition keys applicable across all RAM-supported services.

  • Dependent action: The dependent actions required to run the action. To complete the action, the RAM user or the RAM role must have the permissions to perform all dependent actions.

Action

Access level

Resource type

Condition key

Dependent action

vpc:CreateVSwitch

create

*All Resource

*

  • vpc:tag
None

Request parameters

Parameter

Type

Required

Description

Example

ZoneId

string

Yes

CidrBlock

string

Yes

VpcId

string

Yes

RegionId

string

No

VSwitchName

string

No

Description

string

No

ClientToken

string

No

Response elements

Element

Type

Description

Example

object

VSwitchId

string

RequestId

string

Examples

Success response

JSON format

{
  "VSwitchId": "",
  "RequestId": ""
}

Error codes

HTTP status code

Error code

Error message

Description

400 OperationFailed.IdempotentTokenProcessing Action is processing.
400 InvalidDescription.Malformed Invalid description.
400 InvalidVSwitchName.Malformed Specified virtual switch name is not valid. The vSwitch name is invalid.
400 InvalidVSwitchDiscription.Malformed Specified virtual switch description is not valid. The specified vSwitch description is invalid.
400 ResourceNotAvailable Resource you requested is not available in this region or zone.
400 InvalidParameter Specified CIDR block is not valid in VPC. The specified CIDR block is invalid.
400 InvalidCidrBlock.Overlapped Specified CIDR block overlapped with other subnets. The vSwitch CIDR block overlaps with another vSwitch CIDR block or with the destination CIDR block of a custom route entry. Try a different CIDR block that is not in use.
400 QuotaExceeded.VSwitch Virtual switch quota exceeded. The maximum number of vSwitches has been reached.
400 IncorrectRouteEntryStatus Some route entry status blocked this operation. The operation is not supported while the route table contains routes that are in the Pending or Modifying state.
400 IncorrectVSwitchStatus Some virtual switch is modifying within the same VPC. Multiple vSwitches in the VPC are being modified. Try again later.
400 InvalidCirdrBlock.MaskLength Specified CIDR block is not valid . The specified CIDR block is invalid.
400 IncorrectVpcStatus Current VPC status does not support this operation. The VPC is in a state that does not support the current operation.
400 InvalidCidrBlock.Malformed Specified CIDR block is not valid. The specified CIDR block is invalid.
400 MissingParameter Miss mandatory parameter. Required parameters must be specified.
400 TaskConflict The operation is too frequent, TaskConflict. The operation is too frequent. Wait a moment and try again.
400 RouteConflict.AlreadyExist Route conflict exists in routing table.
400 OperationFailed.CidrAcross Classic link instance cidr must not across.
400 VPC.SWITCH.RULE.QUOTA.NOT.EXISTS vSwitch quota rule not exists.
400 CreateVSwitch.IncorrectStatus.cbnStatus Current CBN status does not support this operation.
400 OperationFailed.NotifyCenCreate Failed to notify cen when create vswitch.
400 Forbidden.VpcNotFound Specified VPC can not found.
400 Duplicated.ClientToken %s
400 OperationFailed.DistibuteLock Distibute lock fail.
400 IllegalParam.CidrBlock The param of CidrBlock [%s] is illegal. The param of CidrBlock [%s] is illegal.
400 OperationDenied.ZoneIsDisabled The specified zone is disabled. You cannot create a vSwitch in a disabled zone. The specified zone is disabled. You cannot create a vSwitch in a disabled zone.
500 InternalError The request processing has failed due to some unknown error.
404 Invalid.NotExist witch mask rule not exists.
404 InvalidStatus.RouteEntry RouteEntry status error.
404 InvalidZoneId.NotFound Specified zone does not exist. The specified zone ID does not exist.
404 InvalidVpcId.NotFound Specified VPC does not exist. The specified VPC ID does not exist.

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.