Creates custom route entries in a route table of a vRouter in a VPC in a batch.
Operation description
- CreateRouteEntries is an asynchronous operation. After you invoke this operation, the system returns an instance ID, but the route has not been created yet. The system is still running the creation task in the background. You can invoke DescribeRouteEntryList to query the creation status of the route:
If the route is in the Creating state, the route is being created.
If the route is in the Created state, the route has been created.
CreateRouteEntries does not support concurrent batch creation of custom route entries in the same VPC.
Take note of the following items when you use this operation to add custom route entries to a route table of a vRouter in a VPC:
-
A route table can contain a maximum of 200 custom route entries.
-
The destination CIDR block (DstCidrBlock) of a custom route entry cannot be the same as, contain, or be contained by the CIDR block of a vSwitch in the VPC.
-
The destination CIDR block (DstCidrBlock) of a custom route entry cannot point to 100.64.0.0/10 or be contained by 100.64.0.0/10.
-
The destination CIDR blocks (DstCidrBlock) of route entries in the same route table must be unique.
-
If the specified destination CIDR block (DstCidrBlock) is an IP address, the system processes it with a 32-bit mask.
-
Multiple custom route entries can point to the same next hop (NextHop).
-
The next hop (NextHop) of a custom route entry must be in the same VPC as the route table.
Try it now
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
vpc:CreateRouteEntries |
create |
*RouteEntry
|
None | None |
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| RegionId |
string |
Yes |
The region ID of the route table. You can call DescribeRegions to query the region ID. |
cn-hangzhou |
| RouteEntries |
array<object> |
Yes |
The list of route entry information. |
|
|
object |
No |
The list of route entry information. |
||
| Description |
string |
No |
The description of the custom route entry. You can specify up to 50 descriptions. The description must be 1 to 256 characters in length and cannot start with |
test |
| DstCidrBlock |
string |
Yes |
The destination CIDR block of the custom route entry. Both IPv4 and IPv6 destination CIDR blocks are supported. You can specify up to 50 destination CIDR blocks. The following requirements must be met:
|
192.168.0.0/24 |
| IpVersion |
integer |
No |
The version of the IP protocol. You can specify up to 50 IP protocol versions. Valid values:
|
4 |
| Name |
string |
No |
The name of the custom route entry to add. You can specify up to 50 names. The name must be 1 to 128 characters in length and cannot start with |
test |
| NextHop |
string |
Yes |
The ID of the next-hop instance of the custom route entry. You can specify up to 50 instance IDs. Note
If you set NextHopType to ECR, you can call DescribeExpressConnectRouterAssociation to obtain the AssociationId as the next-hop ID. |
i-j6c2fp57q8rr4jlu**** |
| NextHopType |
string |
Yes |
The next hop type of the custom route entry. You can specify up to 50 next hop types. Valid values:
|
RouterInterface |
| RouteTableId |
string |
Yes |
The ID of the route table to which you want to add the custom route entry. You can specify up to 50 route table IDs. |
vtb-bp145q7glnuzd**** |
| DryRun |
boolean |
No |
Specifies whether to perform a dry run. Valid values: true: performs a dry run without sending a request to create route entries. The system checks the AccessKey pair, the authorization of the Resource Access Management (RAM) user, and the required parameters. If the check fails, the corresponding error is returned. If the check passes, the error code false (default): sends a normal request. If the check passes, a 2xx HTTP status code is returned and the route entries are created. |
Response elements
|
Element |
Type |
Description |
Example |
|
object |
The number of successful tasks. |
||
| FailedCount |
integer |
The number of route entries that failed to be added. |
2 |
| FailedRouteEntries |
array<object> |
The details of the route entries that failed to be added. |
|
|
object |
The details of the route entries that failed to be added. |
||
| DstCidrBlock |
string |
The destination CIDR block of the custom route entry that failed to be added. |
192.168.0.0/24 |
| FailedCode |
string |
The error code of the failure. |
VPC_ROUTE_ENTRY_CIDR_BLOCK_DUPLICATE |
| FailedMessage |
string |
The error message of the failure. |
Specified CIDR block is already exists, entry.cidrBlock=xxxx |
| NextHop |
string |
The ID of the next-hop instance of the custom route entry that failed to be added. |
i-j6c2fp57q8rr4jlu**** |
| RequestId |
string |
The request ID. |
0ED8D006-F706-4D23-88ED-E11ED28DCAC0 |
| RouteEntryIds |
array |
The instance IDs returned for the custom route entries that were successfully added. |
|
|
string |
The instance ID returned for the custom route entry that was successfully added. |
rte-sn6vjkioxte1gz83z**** |
|
| SuccessCount |
integer |
The number of route entries that were successfully added. |
2 |
Examples
Success response
JSON format
{
"FailedCount": 2,
"FailedRouteEntries": [
{
"DstCidrBlock": "192.168.0.0/24",
"FailedCode": "VPC_ROUTE_ENTRY_CIDR_BLOCK_DUPLICATE",
"FailedMessage": "Specified CIDR block is already exists, entry.cidrBlock=xxxx",
"NextHop": "i-j6c2fp57q8rr4jlu****"
}
],
"RequestId": "0ED8D006-F706-4D23-88ED-E11ED28DCAC0",
"RouteEntryIds": [
"rte-sn6vjkioxte1gz83z****"
],
"SuccessCount": 2
}
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. |
| 400 | InvalidCIDRBlock.Duplicate | Specified CIDR block is already exists. | |
| 400 | MissingParam.RouteTableId | The parameter RouteTableId is missing. | The required parameter RouteTableId is missing. |
| 400 | IncorrectStatus.PrefixListRelation | The related prefix list relation is in an intermediate state and cannot perform the current operation. | The associated prefix list association is in an intermediate state, and the current operation cannot be performed. |
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.