All Products
Search
Document Center

Virtual Private Cloud:CreateRouteTable

Last Updated:Nov 13, 2024

Creates a custom route table.

Operation description

  • 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 within the specified period of time.

Debugging

You can run this interface directly in OpenAPI Explorer, saving you the trouble of calculating signatures. After running successfully, OpenAPI Explorer can automatically generate SDK code samples.

Authorization information

The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:

  • Operation: the value that you can use in the Action element to specify the operation on a resource.
  • Access level: the access level of each operation. The levels are read, write, and list.
  • Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
    • The required resource types are displayed in bold characters.
    • If the permissions cannot be granted at the resource level, All Resources is used in the Resource type column of the operation.
  • Condition Key: the condition key that is defined by the cloud service.
  • Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
OperationAccess levelResource typeCondition keyAssociated operation
vpc:CreateRouteTablecreate
  • RouteTable
    acs:vpc:{#regionId}:{#accountId}:routetable/*
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
RegionIdstringYes

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.

cn-zhangjiakou
VpcIdstringYes

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.
vpc-bp1qpo0kug3a20qqe****
RouteTableNamestringNo

The name of the route table.

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

myRouteTable
DescriptionstringNo

The description of the route table.

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

abc
AssociateTypestringNo

The type of the route table. Valid values:

  • VSwitch (default): vSwitch route table
  • Gateway: gateway route table
VSwitch
ClientTokenstringNo

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. The token can contain only ASCII characters.

Note If you do not specify this parameter, ClientToken is set to the value of RequestId. The value of RequestId in each API request may be different.
02fb3da4-130e-11e9-8e44-0016e04
Tagarray<object>No

The tags of the resource.

objectNo

The tags.

KeystringNo

The tag key. You can specify up to 20 tag keys. The tag key cannot be an empty string.

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

FinanceDept
ValuestringNo

The tag value. 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:.

FinanceJoshua

Response parameters

ParameterTypeDescriptionExample
object

The returned information.

RequestIdstring

The ID of the request.

62172DD5-6BAC-45DF-8D44-E11ED28DCAC0
RouteTableIdstring

The IDs of the route tables.

vtb-bp145q7glnuzdvzu2****

Examples

Sample success responses

JSONformat

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

Error codes

HTTP status codeError codeError messageDescription
400UnsupportedRegionThe feature of ipv4Gateway is not supported in the region.IPv4 gateways are not supported in this region.
400InvalidParameter.RouteTableName.MalformedThe specified route table name is not valid.-
400InvalidParameter.Description.MalformedThe specified Description is not valid.The specified description is invalid.
400QuotaExceeded.RouteTableVPC RouteTable quota exceeded.The quota of VPC route tables is exhausted.
400IncorrectStatus.cbnStatusCurrent CBN status does not support this operation.The status of the CEN instance is invalid.
400InvalidVpcId.NotSupportThe vpc is not support.-
400OperationUnsupported.AdvancedFeatureAdvanced features of the vpc is unsupported.This advanced feature is not supported.
400QuotaExceeded.GatewayRouteTableThe quota of Gateway Route Table is exceeded.The quota of the gateway route table created for a single VPC has reached the upper limit.
404InvalidRegionId.NotFoundSpecified value of RegionId is not supported.-
404InvalidParameter.ActionThis vpc feature is not supported in this region-
404InvalidVpcId.NotFoundSpecified VPC does not exist.The specified VPC does not exist.

For a list of error codes, visit the Service error codes.

Change history

Change timeSummary of changesOperation
2024-05-17The Error code has changedView Change Details
2023-10-23API Description Update. The Error code has changedView Change Details
2023-07-05The Error code has changed. The request parameters of the API has changedView Change Details
2023-06-16The Error code has changedView Change Details
2023-05-22The Error code has changed. The response structure of the API has changedView Change Details