Associates a custom route table with a vSwitch in the same virtual private cloud (VPC).

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
Action String Yes AssociateRouteTable

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

RegionId String Yes cn-hangzhou

The region ID of the VPC to which the route table belongs. You can call the DescribeRegions operation to query the most recent region list.

RouteTableId String Yes vtb-bp145q7glnuzdvzu2****

The ID of the route table.

VSwitchId String Yes vsw-25ncdvfaue4****

The ID of the vSwitch.

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

The client token that is used to ensure the idempotence of the request. You can use the client to generate the parameter value, but you must ensure that it is unique among different requests. The ClientToken value must contain only ASCII characters and cannot exceed 64 characters in length. For more information, see How can I ensure idempotence?

Response parameters

Parameter Type Example Description
RequestId String DC668356-BCB4-42FD-9BC3-FA2B2E04B634

The ID of the request.

Examples

Sample requests

http(s)://vpc.aliyuncs.com/?Action=AssociateRouteTable
&RegionId=cn-hangzhou
&RouteTableId=vtb-bp145q7glnuzdvzu2****
&VSwitchId=vsw-25naue4****
&<Common request parameters>

Sample success responses

XML format

<AssociateRouteTableResponse>
  <RequestId>DC668356-BCB4-42FD-9BC3-FA2B2E04B634</RequestId>
</AssociateRouteTableResponse>

JSON format

{
    "RequestId": "DC668356-BCB4-42FD-9BC3-FA2B2E04B634"
}

Error codes

HttpCode Error code Error message Description
404 InvalidRouteTableId.NotFound Specified route table does not exist. The error message returned because the specified route table does not exist.
400 OperationDenied.CloudBoxVbrEntryExist The operation is not allowed because the routing table has a route entry for the next hop to the cloud box VBR. The error message returned because the route table has a route entry that points to the virtual border router (VBR) of the cloud box.
400 OperationDenied.OtherCloudBoxVbrEntryExist The operation is not allowed because the routing table has a route entry for the next hop that points to a VBR other than this cloud box. The error message returned because the route table has a route entry that points to the VBR of another cloud box.
400 ResourceAlreadyAssociated.RouteTable The specified route table is already associated. The error message returned because the specified route table is already associated.

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