All Products
Search
Document Center

:CreateRouteTable

最終更新日:Aug 21, 2023

Creates a custom route table.

Usage notes

  • CreateRouteTable is an asynchronous operation. After a request is sent, the system returns a request ID and runs the operation in the background. You can call the DescribeRouteTableList operation to query the status of the task.
    • If the custom route table is in the Creating state, the custom route table is being created.
    • If the custom route table is in the Created state, the custom route table is created.
  • You cannot repeatedly call the CreateRouteTable operation to create a custom route table within the specified period of time.

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.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 from 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 1 to 128 characters in length and cannot start with http:// or https://.

Description String No abc

The description of the route table.

The description must be 1 to 256 characters in length, and cannot start with http:// or https://.

AssociateType String No VSwitch

The type of the route table. Valid values:

  • VSwitch (default)
  • Gateway
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 token, but you must make sure that the token is unique among different requests. The token can contain only ASCII characters.

Note If you do not specify this parameter, the system automatically uses the request ID as the client token. The request ID may be different for each API request.
Tag.N.Key String No FinanceDept

The key of tag N to add to the resource. You can specify at most 20 tag keys. The tag key cannot be an empty string.

The tag key can be at most 128 characters in length. It cannot start with aliyun or acs:, and cannot contain http:// or https://.

Tag.N.Value String No FinanceJoshua

The value of tag N to add to the resource. You can specify at most 20 tag values. The tag value can be an empty string.

The tag value can be up to 128 characters in length, and cannot contain http:// or https://. The tag value cannot start with aliyun or acs:.

Response parameters

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

The request ID.

RouteTableId String vtb-bp145q7glnuzdvzu2****

The ID of the 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
&Tag=[{"Key":"FinanceDept","Value":"FinanceJoshua"}]
&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>
</CreateRouteTableResponse>

JSON format

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

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

Error codes

HttpCode Error code Error message Description
400 UnsupportedRegion The feature of ipv4Gateway is not supported in the region. IPv4 gateways are not supported in this region.
400 InvalidParameter.Description.Malformed The specified Description is not valid. The specified description is invalid.
400 QuotaExceeded.RouteTable VPC RouteTable quota exceeded. The quota of VPC route tables is exhausted.
400 IncorrectStatus.cbnStatus Current CBN status does not support this operation. The status of the CEN instance is invalid.
400 OperationUnsupported.AdvancedFeature Advanced features of the vpc is unsupported. The advanced feature is not supported.
404 InvalidVpcId.NotFound Specified VPC does not exist. The VPC is not found.

For a list of error codes, see Service error codes.