All Products
Search
Document Center

Elastic Compute Service:CreateRouteEntry

Last Updated:Apr 27, 2026

Note

This API has been deprecated. We recommend migrating to Vpc(2016-04-28) - CreateRouteEntry for enhanced functionality and continued support. While the deprecated API remains temporarily accessible, no further updates or bug fixes will be provided.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

The table below describes the authorization required to call this API. You can define it in a Resource Access Management (RAM) policy. The table's columns are detailed below:

  • Action: The actions can be used in the Action element of RAM permission policy statements to grant permissions to perform the operation.

  • API: The API that you can call to perform the action.

  • Access level: The predefined level of access granted for each API. Valid values: create, list, get, update, and delete.

  • Resource type: The type of the resource that supports authorization to perform the action. It indicates if the action supports resource-level permission. The specified resource must be compatible with the action. Otherwise, the policy will be ineffective.

    • For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the Resource element of the policy.

    • For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (*) in the Resource element of the policy.

  • Condition key: The condition keys defined by the service. The key allows for granular control, applying to either actions alone or actions associated with specific resources. In addition to service-specific condition keys, Alibaba Cloud provides a set of common condition keys applicable across all RAM-supported services.

  • Dependent action: The dependent actions required to run the action. To complete the action, the RAM user or the RAM role must have the permissions to perform all dependent actions.

Action

Access level

Resource type

Condition key

Dependent action

vpc:CreateRouteEntry

create

*RouteTable

acs:vpc:{#regionId}:{#accountId}:routetable/{#RouteTableId}

None

None

Request parameters

Parameter

Type

Required

Description

Example

RegionId

string

No

The ID of the region. You can call the DescribeRegions operation to get the latest list of regions.

RouteTableId

string

Yes

The ID of the route table.

DestinationCidrBlock

string

Yes

The destination CIDR block. The value must be a valid CIDR block. Set the value to 0.0.0.0/0 to create a default route.

NextHopId

string

No

The ID of the next hop.

Note Specify either NextHopId or NextHopList, but not both.

ClientToken

string

No

A unique, case-sensitive identifier to ensure request idempotency. The token must be 1 to 64 ASCII characters in length.

NextHopType

string

No

The type of the next hop. Valid values:

  • Instance: an ECS instance.

  • HaVip: a high-availability virtual IP address.

  • RouterInterface: a router interface.

  • NetworkInterface: an elastic network interface.

  • VpnGateway: a VPN gateway.

  • Ipv6Gateway: an IPv6 gateway.

  • NatGateway: a NAT gateway.

Note This parameter is required if you specify NextHopId.

NextHopList

array<object>

No

The list of next hops for an ECMP route.

Note Specify either NextHopId or NextHopList, but not both.

object

No

A next hop for the ECMP route.

NextHopId

string

No

The ID of the next hop in the ECMP route.

NextHopType

string

No

The type of the next hop in the ECMP route. Valid values:

  • Instance: an ECS instance.

  • HaVip: a high-availability virtual IP address.

  • RouterInterface: a router interface.

  • NetworkInterface: an elastic network interface.

  • VpnGateway: a VPN gateway.

  • Ipv6Gateway: an IPv6 gateway.

  • NatGateway: a NAT gateway.

Response elements

Element

Type

Description

Example

object

The response data.

RequestId

string

The ID of the request.

Examples

Success response

JSON format

{
  "RequestId": ""
}

Error codes

HTTP status code

Error code

Error message

Description

400

MissingParameter

Miss mandatory parameter.

Required parameters must be specified.

400

InvalidCidrBlock.Malformed

Specified CIDR block is not valid.

The specified CIDR block is invalid.

400

InvalidCIDRBlock.Duplicate

Specified CIDR block is already exists.

The specified CIDR block already exists in the route table.

400

IncorrectVpcStatus

Current VPC status does not support this operation.

The VPC is in a state that does not support the current operation.

400

QuotaExceeded

Route entry quota exceeded in this route table.

The maximum number of router interfaces has been reached.

400

IncorrectRouteEntryStatus

Some route entry status blocked this operation.

The operation is not supported while the route table contains routes that are in the Pending or Modifying state.

400

InvalidCidrBlock

Specified CIDR block is not valid.

The error message is returned maybe because of the following reasons: 1. You are not authorized to use the 10.0.0.0/8 CIDR block. Check whether your account is included in the allowlist to use the CIDR block. 2. The destination CIDR block of the added custom route entry cannot be a subset of the CIDR blocks of the vSwitches in the VPC. 3. The CIDR block cannot be 100.64.0.0/10.

400

InvalidNextHopType

Specified parameter "NextHopType" is not valid

400

InvalidNextHop.NotFound

Specified next hop does not exist.

400

InvalidVRouter.NotFound

vRouter not exists.

400

InvalidVPC.NotFound

vpc not exists.

400

InvalidNexthopTypeAndList.BothNull

both nexthopType and nextHopList are null.

The NextHopType parameter and the NextHopList parameter are required.

400

InvalidNexthopTypeAndList.BothNotNull

both nexthopType and nextHopList are not null.

The NextHopType and NextHopList parameters are required.

400

InvalidRouterInterface

invalid router interface.

The router interface is invalid.

400

InvalidOppositeRouterType

nexthop list cannot only contain router interface whose opposite router interface is on vbr.

The nexthop list cannot only contain router interfaces of which their peer router interfaces are on virtual border routers.

400

InvalidNexthopListSize

nexthop size is illegal. Must be between 2 and 4.

The next hop must be 2 to 4 characters in length.

400

InvalidEntryRuleQuota.NotFound

Route entry quota rule not exists.

The quota rules of route entries do not exist.

400

Forbidden.CheckEntryRuleQuota

Route entry quota rule check error.

An error occurred when the system was checking the quota of route entries.

400

InvalidVBRStatus

invalid virtual border router status.

The VBR state is invalid.

400

InvalidPhysicalConnectionBusinessStatus

invalid physical connection business status.

The Express Connect circuit state is invalid.

400

InvalidRouterType

Cannot specify nexthop list in vbr's route table.

400

IncorrectHaVipStatus

This operation is denied because satus of the specified HaVip is neither Available nor InUse.

The operation is denied because the specified HAVIP is not in the Available or InUse state.

400

CountLimitExceed.HaVipRouteEntry

There can be 5 route entry to HaVip at most in one route table.

400

InvalidRouteEntry.Duplicate

The route entry already exist.

The specified route entry already exists.

400

InvalidParam

The Ecmp routerEntry with router interfaces local vgw vip not match.

The route entry does not match the local gateway VIP of the router interface.

400

INVALID_WEIGHT_PARAM

Specified value of weight invalid

The specified weight is invalid.

400

FORBIDDEN_USE_VPC_AS_INTERNET_GATEWAY

The Specified CIDR must be in vpc CIDR.

400

InvalidNexthop

The Specified nexthop illegal.

400

INVALID_VPC_ID

The Specified VpcId not match.

The specified VPC ID does not match the route entry.

400

InvalidRouteEntrySize

The Specified routerEntry size not legal.

The specified route entry size is invalid.

400

TaskConflict

The operation is too frequent, please wait a moment and try again.

400

InvalidRouteEntry

Specified routeEntry not exist.

400

InvalidDestinationCidrBlock

The specified destinationCidrBlock must not included in black list cidr.

400

VswitchStatusError

The VSwitch is creating .

400

Forbidden.PrivateIpNotFound

Private ip address not exist.

400

RouteConflict.AlreadyExist

Route conflict exists in routing table.

400

OperationUnsupported.InactiveMode

Vpc multi scope route only support active standby.

400

IncorrectStatus.MultiScopeRiRouteEntry

MultiScope ri status must not in idle.

400

OperationUnsupported.MoreThanOneVpnOrHavip

MultiScope can not support more than one vpn/havip.

400

OperationUnsupported.EcmpRiTypeOrNumber

Emcp entry not supported if vpc-vbr or vbr-vlan ri does not exist.

400

Duplicated.VpcNextHop

Route entry nexthop duplicate.

400

OperationUnsupported.SubRouteTableECMP

Vpc subRouteTable don't support ecmp or multiScope.

400

InvalidNexthop.NotFound

VRouterEntry nexthop does not exist.

400

IllegalParam.NextHopId

Instance not exists or not vpc vm.

400

InvalidVpnInstanceId.NotFound

%s

400

OperationFailed.ScopeActiveRouteEntryType

%s

400

OperationFailed.ScopeStandbyRouteEntryQuota

%s

400

OperationFailed.ScopeActiveRouteEntryQuota

%s

400

OperationUnsupported.ScopeInvalidRouteType

%s

400

OperationFailed.EcmpInvalidRouterInterfaceOppositeType

%s

400

QuotaExceeded.HaVipRouteEntry

Vpc havip route entry quota exceed.

400

OperationFailed.InvalidNexthop

vpc multi scope route must has a enable nexthop.

400

OperationFailed.NotifyCenDelete

Failed to notify cen when delete route entry.

400

InvalidNatGateway.NotFound

Natgateway not exist.

400

OperationFailed.CxpRouteExist

Cxp route alreay existed.

400

InvalidNexthop.DirectEni

The direct Eni cannot be nexthop.

400

OperationFailed.NotifyCenCreate

Failed to notify cen when create route entry.

400

IncorrectStatus.RouteTableStatus

%s

400

OperationFailed.GetEniInfo

Failed to get networkInterface info.

400

QuotaExceeded.EcmpRouteEntryNextHopCount

%s

400

OperationFailed.InvalidNextHopType

%s

400

OperationUnsupported.InvalidRouterInterfaceType

Only vpc vbr interface support ecmp route.

400

InvalidHaVip.NotFound

The specified HaVip does not exist in the specified region.

400

OperationFailed.MultiScopeType

The specified nexthop type is not support in multiScope.

400

OperationFailed.DistibuteLock

Distibute lock fail.

403

IncorrectInstanceStatus

The current status of the resource does not support this operation.

404

InvalidNatGatewayId.NotFound

Specified value of NatGatewayId is not found in our record.

404

InvalidInstanId.NotFound

Specified instance does not exist.

The specified instance does not exist. Check whether the instance ID is correct.

404

InvalidNextHopId.NotFound

Specified next hop does not exist.

The specified next hop does not exist.

404

InvalidRouteTableId.NotFound

Specified route table does not exist.

The specified virtual route table does not exist.

404

InvalidHaVipId.NotFound

The specified HaVip does not exist in the specified VPC.

404

InvalidNetworkInterface.NotFound

The specified networkInterface does not exist.

404

InvalidVpc.NotFound

Specified vpc is not found in our record.

404

OperationFailed.InstanceDismatchCurrentVpc

The specified instance does not exist in current vpc.

404

InvalidIpv6Gateway.NotFound

Specified Ipv6Gateway does not exist.

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.