Adds custom route entries to the route table of a vRouter in a virtual private cloud (VPC).
Operation description
References
-
CreateRouteEntries is an asynchronous operation. After a request is sent, the system returns a request ID and runs the task in the background. You can call the DescribeRouteEntryList operation to query the status of the task.
- If the route entry is in the Creating state, the route entry is being created.
- If the route entry is in the Created state, the route entry is created.
-
You cannot repeatedly call the CreateRouteEntries operation to create the same route entry within the specified period of time.
When you call this operation to add custom route entries to the route table of a vRouter, take note of the following items:
- A route table can contain up to 200 custom route entries.
- The destination CIDR block (DstCidrBlock) of a custom route entry cannot be the same as or overlap with the CIDR block of a vSwitch in the VPC.
- The destination CIDR block (DstCidrBlock) of a custom route entry cannot be 100.64.0.0/10 or its subnets.
- The destination CIDR blocks (DstCidrBlock) of route entries in the same route table must be unique.
- If you do not include the mask length when you specify the destination CIDR block (DstCidrBlock), the destination CIDR block is considered a host IP address whose mask length is 32 bits.
- Multiple custom route entries can point to the same next hop (NextHop).
- The next hop (NextHop) of a custom route entry must belong to the same VPC as the route table.
Debugging
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.
Operation | Access level | Resource type | Condition key | Associated operation |
---|---|---|---|---|
vpc:CreateRouteEntries | create |
|
| none |
Request parameters
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
RegionId | string | Yes | The region ID of the route table. You can call the DescribeRegions operation to query the most recent region list. | cn-hangzhou |
RouteEntries | array<object> | Yes | The routes. | |
object | Yes | |||
DstCidrBlock | string | Yes | The destination CIDR block of the custom route. IPv4 CIDR blocks, IPv6 CIDR blocks, and prefix lists are supported. You can enter up to 50 destination CIDR blocks. Make sure that the following requirements are met:
| 192.168.0.0/24 |
RouteTableId | string | Yes | The ID of the route table to which you want to add custom route s. You can specify at most 50 route table IDs. | vtb-bp145q7glnuzd**** |
IpVersion | integer | No | The IP version. Valid values: You can specify at most 50 IP versions. Valid values:
| IPv4 |
NextHop | string | Yes | The ID of the next hop for the custom route. You can specify at most 50 instance IDs. | i-j6c2fp57q8rr4jlu**** |
NextHopType | string | Yes | The type of next hop. You can specify at most 50 next hop types. Valid values:
| RouterInterface |
Name | string | No | The name of the custom route that you want to add. You can specify at most 50 names. The name must be 1 to 128 characters in length and cannot start with | test |
Description | string | No | The description of the custom route. You can specify at most 50 descriptions. The description must be 1 to 256 characters in length and cannot start with | test |
Response parameters
Examples
Sample success responses
JSON
format
{
"SuccessCount": 2,
"FailedCount": 2,
"RequestId": "0ED8D006-F706-4D23-88ED-E11ED28DCAC0",
"FailedRouteEntries": [
{
"DstCidrBlock": "192.168.0.0/24",
"NextHop": "i-j6c2fp57q8rr4jlu****",
"FailedCode": "VPC_ROUTE_ENTRY_CIDR_BLOCK_DUPLICATE",
"FailedMessage": "Specified CIDR block is already exists, entry.cidrBlock=xxxx"
}
],
"RouteEntryIds": [
"rte-sn6vjkioxte1gz83z****"
]
}
Error codes
HTTP status code | Error code | Error message | Description |
---|---|---|---|
400 | DryRunOperation | Request validation has been passed with DryRun flag set. | The request passed the dry run. |
For a list of error codes, visit the Service error codes.
Change history
Change time | Summary of changes | Operation |
---|---|---|
2023-08-07 | API Description Update. The Error code has changed | View Change Details |
2023-03-30 | The Error code has changed | View Change Details |