Associates a custom route table with a vSwitch in the same VPC.
Operation description
The AssociateRouteTable operation is asynchronous. The system returns a request ID, but the route table is not immediately associated. The association task continues in the background. You can call DescribeVSwitchAttributes to query the association status of the route table:
If the vSwitch is in the Pending state, the route table is being associated.
If the vSwitch is in the Available state, the route table is successfully associated.
Try it now
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
vpc:AssociateRouteTable |
update |
*VSwitch
|
None | None |
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| RegionId |
string |
Yes |
The region ID of the VPC to which the route table to be associated with the vSwitch belongs. You can call the DescribeRegions operation to query the region ID. |
cn-hangzhou |
| RouteTableId |
string |
Yes |
The ID of the route table to associate with the vSwitch. |
vtb-bp145q7glnuzdvzu2**** |
| VSwitchId |
string |
Yes |
The ID of the vSwitch to associate with the route table. |
vsw-25ncdvfaue4**** |
| ClientToken |
string |
No |
The client token that is used to ensure the idempotence of the request. You can generate a parameter value on your client to ensure that the value is unique across different requests. The ClientToken parameter supports only ASCII characters. Note
If you do not specify this parameter, the system automatically uses the RequestId of the API request as the ClientToken. The RequestId of each API request may be different. |
02fb3da4-130e-11e9-8e44-0016e04115b |
| RegionId |
string |
Yes |
The region ID of the VPC to which the route table that you want to associate with a vSwitch belongs. You can call DescribeRegions to query the region ID. |
cn-hangzhou |
Response elements
|
Element |
Type |
Description |
Example |
|
object |
|||
| RequestId |
string |
The request ID. |
DC668356-BCB4-42FD-9BC3-FA2B2E04B634 |
Examples
Success response
JSON format
{
"RequestId": "DC668356-BCB4-42FD-9BC3-FA2B2E04B634"
}
Error codes
|
HTTP status code |
Error code |
Error message |
Description |
|---|---|---|---|
| 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 specified operation is not allowed because the route table contains a route entry whose next hop points to a CloudBox VBR. |
| 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 specified operation is not allowed because the route table contains a route entry whose next hop points to a VBR outside the current CloudBox. |
| 400 | ResourceAlreadyAssociated.RouteTable | The resource has already associated with a routetable. | |
| 400 | OperationDenied.AssociateGatewayRouteTable | The operation is not allowed because gateway route tables cannot be bound to a vSwitch. | The vSwitch cannot be associated with a gateway route table. |
| 400 | OperationDenied.SwitchToSystemRouteTable | The associated route tables cannot be directly changed to system route tables. | Failed to switch from the associated route table to the system route table. |
| 400 | ResourceNotFound.VSwitch | The specified resource of VSwitch is not found. | The specified vSwitch does not exist. |
| 400 | InvalidRouteTableId.NotFound | Specified route table does not exist. | |
| 400 | OperationDenied.LocalRouteEntryModified | The next hop of a local route is modified. | The next hop of the local type route has been modified. |
| 400 | MissingParam.VSwitchId | The parameter VSwitchId is missing. | The parameter VSwitchId is missing. |
| 400 | InvalidRegionId.NotFound | Specified value of RegionId is not supported. | |
| 400 | InvalidParameter.Action | This vpc feature is not supported in this region | |
| 400 | IncorrectVSwitchStatus | The current status of the virtual switch does not support this operation. | |
| 400 | Forbidden.VSwitchAlreadyAssociatedRouteTable | The specified virtual switch already associates route table. | |
| 400 | Forbidden.NotInSameVpc | The specified virtual switch and route table are not in the same VPC. | |
| 400 | IncorrectStatus.RouteTable | The status of the specified route table is incorrect. | |
| 404 | InvalidRouteTableId.NotFound | Specified route table does not exist. | |
| 404 | InvalidVSwitchId.NotFound | Specified VSwitch does not exist. |
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.