Modify Routing Tables

Last updated: 2018-08-23 17:45:01

1. API Description

This API (ModifyRouteTableAttribute) is used to modify the attributes of routing table.
Domain for API request:vpc.api.qcloud.com

After the modification, the original content of routing table will be totally replaced with the newly submitted content. If you need to add new routing policies, the new routing policies should be submitted together with the original content of routing table.

2. Input Parameters

The following request parameter list only provides API request parameters. Common request parameters need to be added when the API is called. For more information, refer to Common Request Parameters. The Action field for this API is ModifyRouteTableAttribute.

Parameter Name Required Type Description
vpcId Yes String ID of VPC to which the subnet belongs. It can be vpcId or unVpcId. unVpcId is recommended. For example, vpc-rqndayhs. It can be queried through API DescribeVpcEx.
routeTableId Yes String The routing table ID assigned by the system, which can be routeTableId or unRouteTableId. unRouteTableId is recommended. For example: rtb-rqndayhs. It can be queried through API DescribeRouteTable.
routeTableName No String Routing table name; up to 60 characters.
routeSet.n No array (Optional) Content of routing table.
routeSet.n.destinationCidrBlock Yes String Destination IP address range. It should not be within the VPC IP address range. For example: 112.20.51.0/24.
routeSet.n.nextType Yes String Type of next hop. Supported types: 0: public network gateway; 1: VPN gateway; 3: Direct Connect gateway; 4: peering connection; 7: sslvpn gateway; 8: NAT gateway; 9: general cvm
routeSet.n.nextHub Yes String Next hop address. You just need to specify gateway IDs (new ID is recommended) of different next hop types and the system will automatically match to the next hop address.
routeSet.n.description No String Route description, which should be limited to 60 characters.

3. Output Parameters

Parameter Name Type Description
code Int Error code, 0: Succeeded, other values: Failed.
message String Error message.

4. Error Codes

The following error code list only provides the business logic error codes for this API. For additional common error codes, refer to VPC Error Codes.

Error Code Description
InvalidVpc.NotFound VPC not exist. Please check the information you entered. You can query VPC through API DescribeVpcEx.
InvalidRouteTableId.NotFound Routing table ID not exist. Please check the information you entered. It can be queried through API DescribeRouteTable.
InvalidRouteTableName Invalid routing table name. It should be within 60 characters.
RouteLimitExceeded Reached the upper limit of routing table policies. Please contact customer service for more resources. For more information, refer to VPC Usage Restrictions.
RouteAlreadyExists The destination IP address range already exists in the routing table policy.
InvalidRouteNextType Invalid next hop type. For supported types, refer to the descriptions of input parameters.
InvalidRouteNextHub.NotFound The next hop address does not exist. Please check the information you entered.
InvalidRoute.NextHubLimitExceeded The maximum number of paths in public network gateway ECMP is 8.

5. Example

Input


  https://vpc.api.qcloud.com/v2/index.php?Action=ModifyRouteTableAttribute
  &<Common request parameters>
  &vpcId=vpc-amhnnao5
  &routeTableId=rtb-8oidkjt2
  &routeSet.0.destinationCidrBlock=121.0.23.51/18
  &routeSet.0.nextType=1
  &routeSet.0.nextHub=vpngw-dystbrkv
  &routeTableName=tttt111

Output


{
    "code": 0,
    "message": ""
}