CreateRouteEntries
Adds custom route entries in batches to the route table of a vRouter.
Operation description
- The CreateRouteEntries operation is asynchronous. The system returns an instance ID, but the route creation is not yet complete and background startup tasks are still running. You can call the DescribeRouteEntryList operation 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 is created.
The CreateRouteEntries operation does not support concurrent batch creation of custom route entries in the same VPC.
When you use this operation to add a custom route entry to the route table of a vRouter, take note of the following items:
-
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 the CIDR block of a vSwitch in the VPC. The destination CIDR block cannot contain or be contained by the CIDR block of the vSwitch.
-
The destination CIDR block (DstCidrBlock) of a custom route entry cannot be 100.64.0.0/10 or fall within 100.64.0.0/10.
-
Route entries in the same route table cannot have the same destination CIDR block (DstCidrBlock).
-
If the specified destination CIDR block (DstCidrBlock) is an IP address, it is processed with a 32-bit subnet 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 ID of the region to which the route table belongs. You can call the DescribeRegions operation to query region IDs. |
cn-hangzhou |
| RouteEntries |
array<object> |
Yes |
The list of route entries. |
|
|
object |
No |
The list of route entries. |
||
| DstCidrBlock |
string |
Yes |
The destination CIDR block of the custom route entry. Both IPv4 and IPv6 CIDR blocks are supported. You can specify up to 50 destination CIDR blocks. The destination CIDR block must meet the following requirements:
|
192.168.0.0/24 |
| 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**** |
| IpVersion |
integer |
No |
The IP version. You can specify up to 50 IP versions. Valid values:
|
4 |
| NextHop |
string |
Yes |
The ID of the next hop instance for the custom route entry. You can specify up to 50 instance IDs. Note
If you set NextHopType to ECR, you can call the DescribeExpressConnectRouterAssociation operation to obtain the AssociationId as the next hop ID. |
i-j6c2fp57q8rr4jlu**** |
| NextHopType |
string |
Yes |
The type of the next hop for the custom route entry. You can specify up to 50 next hop types. Valid values:
|
RouterInterface |
| Name |
string |
No |
The name of the custom route entry to be added. You can specify up to 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 entry. You can specify up to 50 descriptions. The description must be 1 to 256 characters in length and cannot start with |
test |
| DryRun |
boolean |
No |
Specifies whether to only perform a dry run for this request. Valid values: true: The system sends the request and performs a dry run without creating the custom route entry. The system checks whether your AccessKey pair is valid, the authorization of the Resource Access Management (RAM) user, and whether the required parameters are specified. If the request fails the dry run, the system returns an error. If the request passes the dry run, the system returns the false (default): The system sends a normal request. If the request passes the dry run, the system returns a 2xx HTTP status code and directly creates the custom route entry. |
Response elements
|
Element |
Type |
Description |
Example |
|
object |
The number of successful tasks. |
||
| SuccessCount |
integer |
The number of route entries that are added. |
2 |
| FailedCount |
integer |
The number of route entries that fail to be added. |
2 |
| RequestId |
string |
The request ID. |
0ED8D006-F706-4D23-88ED-E11ED28DCAC0 |
| FailedRouteEntries |
array<object> |
The details of the route entries that fail to be added. |
|
|
object |
The details of the route entries that fail to be added. |
||
| DstCidrBlock |
string |
The destination CIDR block of the custom route entry that fails to be added. |
192.168.0.0/24 |
| NextHop |
string |
The ID of the next hop instance for the custom route entry that fails to be added. |
i-j6c2fp57q8rr4jlu**** |
| FailedCode |
string |
The error code for the failure. |
VPC_ROUTE_ENTRY_CIDR_BLOCK_DUPLICATE |
| FailedMessage |
string |
The specific error message for the failure. |
Specified CIDR block is already exists, entry.cidrBlock=xxxx |
| RouteEntryIds |
array |
The instance IDs returned for the successfully added custom route entries. |
|
|
string |
The instance ID returned for the successfully added custom route entry. |
rte-sn6vjkioxte1gz83z**** |
Examples
Success response
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. |
| 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. |
| 400 | IncorrectStatus.NextHop | The status of %s [%s] is incorrect. | Specified next hop resource |
| 400 | InvalidNextHop.NotFound | The specified NextHop does not exist. | The specified next hop does not exist. |
| 400 | OperationDenied.NatGatewayIpv6NotEnabled | The IPv6 feature is not enabled for the NAT gateway. | The IPv6 feature is not enabled for the NAT gateway. |
| 400 | ResourceNotFound.NetworkInterface | The specified resource of network interface is not found. | The specified ENI does not exist. |
| 400 | OperationUnsupported.MultipleIpv6Address | Operation unsupported because specific route next hop instance has multiple IPv6 address. | The operation is not supported because the specified route next hop instance is bound to multiple IPv6 addresses |
| 400 | OperationFailed.NotSupportIPV6 | The specified next hop does not support IPv6. | The specified next hop does not support IPv6. |
| 400 | IncorrectStatus.Ipv6Address | The IPv6 address of the specified next hop is being assigned or deleted. | The IPv6 address that is specified as the next hop is being created or being deleted. |
| 404 | ResourceNotFound.NatGateway | The NatGateway instance not exist. | The NAT gateway does not exist. |
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.