Associates a custom route table with a VSwitch in the same VPC.

Make the API call

You can use OpenAPI Explorer to make API calls, search for API calls, perform debugging, and generate SDK example code.

Request parameters

Parameter Type Required? Example value Description
Action String  Yes AssociateRouteTable

The name of this action. Value: AssociateRouteTable

RegionId String  Yes cn-hangzhou

The region ID of the VPC to which the route table belongs. To query the region ID, call DescribeRegions.

RouteTableId String  Yes vtb-bp145q7glnuzdvzu2****

The ID of the route table to be associated with the VSwitch.

VSwitchId String  Yes vsw-25ncdvfaue4****

The ID of the VSwitch to be associated with the route table.

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

The client token that guarantees the idempotence of the request. The value of this parameter is generated by the client and is unique among different requests. The ClientToken value is 1 to 64 ASCII characters in length. For more information, see How to ensure idempotence.

Response parameters

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

The ID of the request.

Examples

Request example


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

Response example

XML format

<AssociateRouteTableResponse>
      <RequestId>62172DD5-6BAC-45DF-8D44-xxxxxxx</RequestId>
</AssociateRouteTableResponse>

JSON format

{
	"RequestId":"62172DD5-6BAC-45DF-8D44-xxxxxxxx"
}

Errors

HTTP status code Error code Error message Description
404 InvalidRouteTableId.NotFound Specified route table does not exist. The specified route table does not exist.

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