edit-icon download-icon

CreateVSwitch

Last Updated: Apr 09, 2018

Description

Create a VSwitch in the specified VPC.

Note the following before creating a VSwitch:

  • Up to 24 VSwitches can be created in a VPC.

  • The first and last three IP addresses of the VSwitch are reserved by the system. For example, if the CIDR block of a VSwitch is 192.168.1.0/24, IP addresses 192.168.1.0, 192.168.1.253, 192.168.1.254, and 192.168.1.255 are reserved.

  • The CIDR block of the VSwitch cannot be modified after the VSwitch is created.

  • The number of cloud product instances under the VSwitch cannot exceed the remaining capacity of the VPC (subtract the current number of cloud product instances from 15,000).

  • A cloud product instance can only belong to one VSwitch.

  • VSwitches do not support broadcasting or multicasting.

Request parameters

Name Type Required Description
Action String Yes

The action to perform.

Valid value: CreateVSwitch

ZoneId String Yes The ID of the zone.
CidrBlock String Yes

The IP address range of the VSwitch in the CIDR block form.

The IP address range must meet the following requirements:

  • The size of the subnet mask for the VSwitch can be /16 to /29.

  • The CIDR block of the VSwitch must belong to the CIDR block of the VPC. When the CIDR block of the VSwitch is the same as that of the VPC, the VPC can contain only one VSwitch.

  • The CIDR block of the VSwitch cannot be the same as any destination CIDR block in route entries of the VPC, but can be the subset of the destination CIDR block.

VpcId String Yes The ID of the VPC to which the VSwitch belongs.
VSwitchName String No

The name of the VSwitch.

The name must start with an English letter, but cannot start withhttp:// or https://.

The name can contain from 2 to 128 characters including a-z, A-Z, 0-9, underlines, and hyphens.

Description String No

The description of the VSwitch.

The description must start with English letters, but cannot start with http:// or https://.

The description can contain from 2 to 256 characters.

ClientToken String No A client token used to guarantee the idempotence of requests. This parameter value is generated by the client and must be unique. It cannot exceed 64 ASCII characters.

For more information, see How to ensure idempotence.

Response parameters

Name Type Description
RequestId String The ID of the request.
VSwitchId String The ID of the VSwitch.

Error codes

See VPC API Error Center.

Examples

Request example

  1. https://vpc.aliyuncs.com/?Action=CreateVSwitch
  2. &CidrBlock=172.16.1.0/24
  3. &VpcId=vpc-257gq642n
  4. &ZoneId=cn-beijing-a
  5. &<CommonParameters>

Response example

XML format

  1. <CreateVSwitchResponse>
  2. <RequestId>861E6630-AEC0-4B2D-B214-6CB5E44B7F04</RequestId>
  3. <VSwitchId>vsw-25naue4gz</VSwitchId>
  4. </CreateVSwitchResponse>

JSON format

  1. {
  2. "RequestId": "861E6630-AEC0-4B2D-B214-6CB5E44B7F04",
  3. "VSwitchId": "vsw-25naue4gz"
  4. }
Thank you! We've received your feedback.