Creates a custom route table.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter Type Required Example Description
RegionId String Yes cn-zhangjiakou

The region ID of the virtual private cloud (VPC) to which the custom route table belongs.

You can call the DescribeRegions operation to query the most recent region list.

VpcId String Yes vpc-bp1qpo0kug3a20qqe****

The ID of the VPC to which the custom route table belongs.

If a VPC contains an Elastic Compute Service (ECS) instance that belongs to one of the following instance families, you cannot create a custom route table for the VPC:

ecs.c1, ecs.c2, ecs.c4, ecs.c5, ecs.ce4, ecs.cm4, ecs.d1, ecs.e3, ecs.e4, ecs.ga1, ecs.gn4, ecs.gn5, ecs.i1, ecs.m1, ecs.m2, ecs.mn4, ecs.n1, ecs.n2, ecs.n4, ecs.s1, ecs.s2, ecs.s3, ecs.se1, ecs.sn1, ecs.sn2, ecs.t1, and ecs.xn4.

You must upgrade or release the ECS instance before you can create a custom route table for the VPC.

Note If a custom route table is created for a VPC that contains an ECS instance that belongs to one of the preceding instance families, you must upgrade or release the ECS instance. Otherwise, the custom route table cannot work as expected.
RouteTableName String No myRouteTable

The name of the route table.

The name must be 2 to 128 characters in length, and can contain letters, digits, periods (.), underscores (_), and hyphens (-). The name must start with a letter.

Description String No abc

The description of the route table.

The description must be 2 to 256 characters in length. It must start with a letter but cannot start with http:// or https://.

AssociateType String No VSwitch

The type of the route table. Valid values:

  • VSwitch: vSwitch route table
  • Gateway: gateway route table
Action String Yes CreateRouteTable

The operation that you want to perform. Set the value to CreateRouteTable.

ClientToken String No 02fb3da4-130e-11e9-8e44-0016e04

The client token that is used to ensure the idempotence of the request.

You can use the client to generate the value, but you must make sure that it is unique among different requests.

Note If you do not set this parameter, the system uses RequestId as ClientToken. RequestId may be different for each API request.

Response parameters

Parameter Type Example Description
RequestId String 62172DD5-6BAC-45DF-8D44-E11ED28DCAC0

The ID of the request.

RouteTableId String vtb-bp145q7glnuzdvzu2****

The ID of the route table.

AssociateType String VSwitch

The type of the route table. Valid values:

  • VSwitch: vSwitch route table
  • Gateway: gateway route table

Examples

Sample requests

http(s)://[Endpoint]/?RegionId=cn-zhangjiakou
&VpcId=vpc-bp1qpo0kug3a20qqe****
&RouteTableName=myRouteTable
&Description=abc
&AssociateType=VSwitch
&Action=CreateRouteTable
&ClientToken=02fb3da4-130e-11e9-8e44-0016e04
&Common request parameters

Sample success responses

XML format

HTTP/1.1 200 OK
Content-Type:application/xml

<CreateRouteTableResponse>
    <RequestId>62172DD5-6BAC-45DF-8D44-E11ED28DCAC0</RequestId>
    <RouteTableId>vtb-bp145q7glnuzdvzu2****</RouteTableId>
    <AssociateType>VSwitch</AssociateType>
</CreateRouteTableResponse>

JSON format

HTTP/1.1 200 OK
Content-Type:application/json

{
  "RequestId" : "62172DD5-6BAC-45DF-8D44-E11ED28DCAC0",
  "RouteTableId" : "vtb-bp145q7glnuzdvzu2****",
  "AssociateType" : "VSwitch"
}

Error codes

HttpCode Error code Error message Description
400 InvalidParameter.Description.Malformed The specified Description is not valid. The error message returned because the specified description is invalid.
400 IncorrectStatus.cbnStatus Current CBN status does not support this operation. The error message returned because the status of the Cloud Enterprise Network (CEN) instance is invalid.
404 InvalidVpcId.NotFound Specified VPC does not exist. The error message returned because the specified VPC does not exist.

For a list of error codes, visit the API Error Center.