All Products
Search
Document Center

Cloud Enterprise Network:CreateRouteMapRule

Last Updated:Oct 30, 2026

Creates a route map rule.

Operation description

Request description

  • RouteMapId is a required parameter that specifies the route map to which the new rule belongs.

  • Priority is a required parameter. A smaller value indicates a higher priority. Rules within the same route map cannot have duplicate priorities.

  • Name and Description are optional parameters used to identify the rule and describe its purpose.

  • MatchConditions defines the match conditions for the rule, and SetActions defines the actions to be executed when a route meets all match conditions. Both are passed as JSON strings.

  • DryRun is an optional parameter used to precheck the request without actually creating the route map rule.

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

No authorization for this operation. If you encounter issues with this operation, contact technical support.

Request syntax

POST / HTTP/1.1

Request parameters

Parameter

Type

Required

Description

Example

ClientToken

string

No

The client token that is used to ensure the idempotence of the request.

You can generate the parameter value on your client. Make sure that the token is unique across different requests. The client token supports only ASCII characters.

Note

If you do not specify this parameter, the system automatically uses the RequestId of the API request as the ClientToken. The RequestId of each API request may be different.

02fb3da4-130e-11e9-8e44-001****

RouteMapId

string

Yes

The ID of the route map.

rm-0a1b2c3d4e5f6a7b8

Name

string

No

The name of the rule for easy identification. The name can be empty or 1 to 128 characters in length, and cannot start with http:// or https://.

Permit-Prod-Prefixes-Set-LP

Description

string

No

The detailed description of the rule. The description can be empty or 1 to 256 characters in length, and cannot start with http:// or https://.

Matches production prefixes from on-prem and sets a higher local preference.

Priority

integer

Yes

The priority of the rule. A smaller value indicates a higher priority.

10

DryRun

boolean

No

Specifies whether to only precheck the request. Valid values:

  • true: Prechecks the request without creating the route map rule. The system checks whether required parameters are specified, the request format, and service limits. If the request fails the precheck, the corresponding error is returned. If the request passes the precheck, the DryRunOperation error code is returned.

  • false (default): Sends the request. After the request passes the precheck, the route map rule is created.

false

MatchConditions

object

No

The match conditions of the route map rule. The system executes the actions defined in SetActions only when a route meets all the match conditions defined in this parameter.

AddressPrefixesInclude

array

No

The route prefix list for fuzzy match. You can specify up to 64 IP address blocks.

A match is successful if the route prefix in the match condition contains the route prefix of the matched route.

For example, a policy defined with 10.0.0.0/8 can fuzzy match a route with 10.10.10.0/24.

IP address blocks use the CIDR format and support IPv4 and IPv6.

This parameter is mutually exclusive with AddressPrefixesMatch. You cannot specify both parameters at the same time.

string

No

The route prefix list for fuzzy match. You can specify up to 64 IP address blocks.

A match is successful if the route prefix in the match condition contains the route prefix of the matched route.

For example, a policy defined with 10.0.0.0/8 can fuzzy match a route with 10.10.10.0/24.

IP address blocks use the CIDR format and support IPv4 and IPv6.

This parameter is mutually exclusive with AddressPrefixesMatch. You cannot specify both parameters at the same time.

10.0.0.0/8

AddressPrefixesMatch

array

No

The route prefix list for exact match. You can specify up to 64 IP address blocks.

A match is successful only if the route prefix in the match condition is exactly the same as the route prefix of the matched route.

For example, a policy defined with 10.0.0.0/8 can only exactly match a route with 10.0.0.0/8.

IP address blocks use the CIDR format and support IPv4 and IPv6.

This parameter is mutually exclusive with AddressPrefixesInclude. You cannot specify both parameters at the same time.

string

No

The route prefix list for exact match. You can specify up to 64 IP address blocks.

A match is successful only if the route prefix in the match condition is exactly the same as the route prefix of the matched route.

For example, a policy defined with 10.0.0.0/8 can only exactly match a route with 10.0.0.0/8.

IP address blocks use the CIDR format and support IPv4 and IPv6.

This parameter is mutually exclusive with AddressPrefixesInclude. You cannot specify both parameters at the same time.

10.0.0.0/8

AsPathsInclude

array

No

The list of AS paths for fuzzy match. You can specify up to 64 AS numbers.

A match is successful if the AS path in the match condition overlaps with the AS path of the matched route.

This parameter is mutually exclusive with AsPathsMatch. You cannot specify both parameters at the same time.

Note

Only AS SEQUENCE is supported. AS SET, AS CONFED SEQUENCE, and AS CONFED SET are not supported. This means only a list of AS numbers is supported, and sets and sublists are not supported.

integer

No

The list of AS paths for fuzzy match. You can specify up to 64 AS numbers.

A match is successful if the AS path in the match condition overlaps with the AS path of the matched route.

This parameter is mutually exclusive with AsPathsMatch. You cannot specify both parameters at the same time.

Note

Only AS SEQUENCE is supported. AS SET, AS CONFED SEQUENCE, and AS CONFED SET are not supported. This means only a list of AS numbers is supported, and sets and sublists are not supported.

65000

AsPathsMatch

array

No

The list of AS paths for exact match. You can specify up to 64 AS numbers.

A match is successful only if the AS path in the match condition is exactly the same as the AS path of the matched route.

This parameter is mutually exclusive with AsPathsInclude. You cannot specify both parameters at the same time.

Note

Only AS SEQUENCE is supported. AS SET, AS CONFED SEQUENCE, and AS CONFED SET are not supported. This means only a list of AS numbers is supported, and sets and sublists are not supported.

integer

No

The list of AS paths for exact match. You can specify up to 64 AS numbers.

A match is successful only if the AS path in the match condition is exactly the same as the AS path of the matched route.

This parameter is mutually exclusive with AsPathsInclude. You cannot specify both parameters at the same time.

Note

Only AS SEQUENCE is supported. AS SET, AS CONFED SEQUENCE, and AS CONFED SET are not supported. This means only a list of AS numbers is supported, and sets and sublists are not supported.

65000

CommunitySetInclude

array

No

The community set for fuzzy match. You can specify up to 64 communities.

A match is successful if the community in the match condition overlaps with the community of the matched route.

Each community is in the format of n:m, where n and m range from 1 to 65535. The community must comply with RFC 1997. Large communities (RFC 8092) are not supported.

This parameter is mutually exclusive with CommunitySetMatch. You cannot specify both parameters at the same time.

Note

Incorrect community configurations may prevent routes from being advertised to the on-premises data center.

string

No

The community set for fuzzy match. You can specify up to 64 communities.

A match is successful if the community in the match condition overlaps with the community of the matched route.

Each community is in the format of n:m, where n and m range from 1 to 65535. The community must comply with RFC 1997. Large communities (RFC 8092) are not supported.

This parameter is mutually exclusive with CommunitySetMatch. You cannot specify both parameters at the same time.

Note

Incorrect community configurations may prevent routes from being advertised to the on-premises data center.

65000:100

CommunitySetMatch

array

No

The community set for exact match. You can specify up to 64 communities.

A match is successful only if the community in the match condition is exactly the same as the community of the matched route.

Each community is in the format of n:m, where n and m range from 1 to 65535. The community must comply with RFC 1997. Large communities (RFC 8092) are not supported.

This parameter is mutually exclusive with CommunitySetInclude. You cannot specify both parameters at the same time.

Note

Incorrect community configurations may prevent routes from being advertised to the on-premises data center.

string

No

The community set for exact match. You can specify up to 64 communities.

A match is successful only if the community in the match condition is exactly the same as the community of the matched route.

Each community is in the format of n:m, where n and m range from 1 to 65535. The community must comply with RFC 1997. Large communities (RFC 8092) are not supported.

This parameter is mutually exclusive with CommunitySetInclude. You cannot specify both parameters at the same time.

Note

Incorrect community configurations may prevent routes from being advertised to the on-premises data center.

65000:100

DestinationInstanceIds

array

No

The list of destination instance IDs to match. You can specify the following types of instance IDs:

  • Virtual Private Cloud (VPC) instance IDs

  • Virtual Border Router (VBR) instance IDs

You can specify up to 64 instance IDs.

Note

The list of destination instance IDs takes effect only when the direction of the route map is outbound.

string

No

The list of destination instance IDs to match. You can specify the following types of instance IDs:

  • Virtual Private Cloud (VPC) instance IDs

  • Virtual Border Router (VBR) instance IDs

You can specify up to 64 instance IDs.

Note

The list of destination instance IDs takes effect only when the direction of the route map is outbound.

vbr-gw8jiyiedko141709c903

DestinationInstanceIdsReverseMatch

boolean

No

Specifies whether to use the exclusion match mode for the list of destination instance IDs. Valid values:

  • false (default): No. A match is successful if the destination instance ID of the route is in DestinationInstanceIds.N.

  • true: Yes. A match is successful if the destination instance ID of the route is not in DestinationInstanceIds.N.

false

DestinationInstanceTypes

array

No

The list of destination instance types to match. The following instance types are supported:

  • VPC: VPC instance.

  • VBR: VBR instance.

You can specify multiple instance types.

Note

The list of destination instance types takes effect only when the direction of the route map is outbound.

string

No

The list of destination instance types to match. The following instance types are supported:

  • VPC: VPC instance.

  • VBR: VBR instance.

You can specify multiple instance types.

Note

The list of destination instance types takes effect only when the direction of the route map is outbound.

VPC

DestinationRegionIds

array

No

The list of destination region IDs to match. You can specify up to 64 region IDs.

string

No

The list of destination region IDs to match. You can specify up to 64 region IDs.

all

DestinationRouteTableIds

array

No

The list of destination route table IDs to match. You can specify up to 64 route table IDs.

Note

The list of destination route table IDs takes effect only when the direction of the route map is outbound.

string

No

The list of destination route table IDs to match. You can specify up to 64 route table IDs.

Note

The list of destination route table IDs takes effect only when the direction of the route map is outbound.

vtb-wz9x2kcw75vsceun3a0wg

MatchAddressType

string

No

The IP address type of the routes to match. Valid values:

  • IPv4: Matches only IPv4 routes.

  • IPv6: Matches only IPv6 routes.

You can leave this parameter empty to match routes of all types.

IPv4

RouteTypes

array

No

The list of route types to match. The following route types are supported:

  • System: system route, which is automatically generated by the system.

  • Custom: custom route, which is manually added by the user.

  • BGP: BGP route, which is propagated through the BGP routable protocol.

You can specify multiple route types.

string

No

The list of route types to match. The following route types are supported:

  • System: system route, which is automatically generated by the system.

  • Custom: custom route, which is manually added by the user.

  • BGP: BGP route, which is propagated through the BGP routable protocol.

You can specify multiple route types.

System

SourceInstanceIds

array

No

The list of source instance IDs to match. You can specify the following types of instance IDs:

  • Virtual Private Cloud (VPC) instance IDs

  • Virtual Border Router (VBR) instance IDs

You can specify up to 64 instance IDs.

string

No

The list of source instance IDs to match. You can specify the following types of instance IDs:

  • Virtual Private Cloud (VPC) instance IDs

  • Virtual Border Router (VBR) instance IDs

You can specify up to 64 instance IDs.

vpc-2zea9zsh6ce30nfcjlvyr

SourceInstanceIdsReverseMatch

boolean

No

Specifies whether to use the exclusion match mode for the list of source instance IDs. Valid values:

  • false (default): No. A match is successful if the source instance ID of the route is in SourceInstanceIds.N.

  • true: Yes. A match is successful if the source instance ID of the route is not in SourceInstanceIds.N.

false

SourceInstanceTypes

array

No

The list of source instance types to match. The following instance types are supported:

  • VPC: VPC instance.

  • VBR: VBR instance.

You can specify multiple instance types.

string

No

The list of source instance types to match. The following instance types are supported:

  • VPC: VPC instance.

  • VBR: VBR instance.

You can specify multiple instance types.

VPC

SourceRegionIds

array

No

The list of source region IDs to match. You can specify up to 64 region IDs.

string

No

The list of source region IDs to match. You can specify up to 64 region IDs.

cn-hongkong

SourceRouteTableIds

array

No

The list of source route table IDs to match. You can specify up to 64 route table IDs.

string

No

The list of source route table IDs to match. You can specify up to 64 route table IDs.

vtb-uf684wwipxgflzkpe4zgd

SetActions

object

No

The actions to execute for the route map rule. After a route meets all the match conditions defined in MatchConditions, the system processes the route based on the actions defined in this parameter.

AsPathPrepend

array

No

The AS path to prepend when the regional gateway receives a route or executes a publish route entry. You can specify up to 64 AS numbers.

This parameter is mutually exclusive with AsPathReplace. You cannot specify both parameters at the same time.

This parameter specifies the action to execute after a route meets the match conditions.

integer

No

The AS path to prepend when the regional gateway receives a route or executes a publish route entry. You can specify up to 64 AS numbers.

This parameter is mutually exclusive with AsPathReplace. You cannot specify both parameters at the same time.

This parameter specifies the action to execute after a route meets the match conditions.

65000

AsPathReplace

array

No

The AS path to replace when the regional gateway receives a route or executes a publish route entry. The original AS path of the route is replaced with the list of AS numbers specified in this parameter. You can specify up to 64 AS numbers.

This parameter is mutually exclusive with AsPathPrepend. You cannot specify both parameters at the same time.

This parameter specifies the action to execute after a route meets the match conditions.

integer

No

The AS path to replace when the regional gateway receives a route or executes a publish route entry. The original AS path of the route is replaced with the list of AS numbers specified in this parameter. You can specify up to 64 AS numbers.

This parameter is mutually exclusive with AsPathPrepend. You cannot specify both parameters at the same time.

This parameter specifies the action to execute after a route meets the match conditions.

65123

CommunityAdd

array

No

The community set to add to the route. You can specify up to 64 communities.

Each community is in the format of n:m, where n and m range from 1 to 65535. The community must comply with RFC 1997. Large communities (RFC 8092) are not supported.

This parameter is mutually exclusive with CommunityReplace. You cannot specify both parameters at the same time.

This parameter specifies the action to execute after a route meets the match conditions.

Note

Incorrect community configurations may prevent routes from being advertised to the on-premises data center.

string

No

The community set to add to the route. You can specify up to 64 communities.

Each community is in the format of n:m, where n and m range from 1 to 65535. The community must comply with RFC 1997. Large communities (RFC 8092) are not supported.

This parameter is mutually exclusive with CommunityReplace. You cannot specify both parameters at the same time.

This parameter specifies the action to execute after a route meets the match conditions.

Note

Incorrect community configurations may prevent routes from being advertised to the on-premises data center.

65000:100

CommunityReplace

array

No

The community set to replace the original community of the route. You can specify up to 64 communities.

Each community is in the format of n:m, where n and m range from 1 to 65535. The community must comply with RFC 1997. Large communities (RFC 8092) are not supported.

This parameter is mutually exclusive with CommunityAdd. You cannot specify both parameters at the same time.

This parameter specifies the action to execute after a route meets the match conditions.

Note

Incorrect community configurations may prevent routes from being advertised to the on-premises data center.

string

No

The community set to replace the original community of the route. You can specify up to 64 communities.

Each community is in the format of n:m, where n and m range from 1 to 65535. The community must comply with RFC 1997. Large communities (RFC 8092) are not supported.

This parameter is mutually exclusive with CommunityAdd. You cannot specify both parameters at the same time.

This parameter specifies the action to execute after a route meets the match conditions.

Note

Incorrect community configurations may prevent routes from being advertised to the on-premises data center.

65000:200

NextPriority

integer

No

Policy priority of the associated next route map rule.

  • You can set policy priority of the associated route map rule only when RouteAction is set to Permit. Only the routes that are permitted continue to match the associated next route map rule.

  • Policy priority of the associated next route map rule must be lower than policy priority of the current route map rule.

1

RouteAction

string

No

The policy action after all conditions are met. Valid values:

  • Permit: Permits the matched routes.

  • Deny: Denies the matched routes.

Valid values:

  • Permit :

    Permits the matched route.

  • Deny :

    Denies the matched route.

Permit

Response elements

Element

Type

Description

Example

object

RequestId

string

The request ID.

EF44D7B7-6248-5A60-8A4C-A92388605A57

RouteMapRuleId

string

The ID of the route map rule.

rmr-3dm13f66wtctcnydup

Examples

Success response

JSON format

{
  "RequestId": "EF44D7B7-6248-5A60-8A4C-A92388605A57",
  "RouteMapRuleId": "rmr-3dm13f66wtctcnydup"
}

Error codes

HTTP status code

Error code

Error message

Description

400 InstanceNotExist.RouteMap The RouteMap does not exist. The routing policy does not exist.
400 IncorrectStatus.RouteMap RouteMap is not in a valid state for the operation. RouteMap is not in a valid state for the operation.
400 InvalidOperation.RouteMapRulePriorityConflict Operation is invalid because the route map rule priority conflicts with existing rules. Operation is invalid because the route map rule priority conflicts with existing rules.
400 QuotaExceeded.RouteMapRule The maximum number of RouteMap rule is exceeded. The maximum number of RouteMap rule is exceeded.
400 QuotaExceeded.RouteMapRulePerEcr The maximum number of RouteMap Rule per ECR instance is exceeded. The maximum number of RouteMap Rule per ECR instance is exceeded.
400 InvalidOperation.RouteMapCheckFailed Operation is invalid because the route map check failed. Operation is invalid because the route map check failed.
400 InvalidOperation.UnsupportedRouteMapRule Operation is invalid because the route map rule contains unsupported configurations for associated instances. Operation is invalid because the route map rule contains unsupported configurations for associated instances.
400 ParamExclusive.AddressPrefixesIncludeAndAddressPrefixesMatch AddressPrefixesInclude and AddressPrefixesMatch are mutually exclusive. Parameter AddressPrefixesInclude and AddressPrefixesMatch are mutually exclusive.
400 ParamExclusive.CommunitySetMatchAndCommunitySetInclude Parameter CommunitySetMatch And CommunitySetInclude are mutually exclusive. Parameter CommunitySetMatch And CommunitySetInclude are mutually exclusive.
400 ParamExclusive.AsPathsMatchAndAsPathsInclude Parameter AsPathsMatch And AsPathsInclude are mutually exclusive. Parameter AsPathsMatch And AsPathsInclude are mutually exclusive.
400 InvalidParameter.MatchConditions.AddressPrefixesMatch The specified parameter "MatchConditions.AddressPrefixesMatch" is invalid. The specified parameter "MatchConditions.AddressPrefixesMatch" is invalid.
400 InvalidParameter.MatchConditions.AddressPrefixesInclude The specified parameter "MatchConditions.AddressPrefixesInclude" is invalid. The specified parameter "MatchConditions.AddressPrefixesInclude" is invalid.
400 InvalidParameter.MatchConditions.CommunitySetMatch The specified parameter "MatchConditions.CommunitySetMatch" is invalid. The specified parameter "MatchConditions.CommunitySetMatch" is invalid.
400 InvalidParameter.MatchConditions.CommunitySetInclude The specified parameter "MatchConditions.CommunitySetInclude" is invalid. The specified parameter "MatchConditions.CommunitySetInclude" is invalid.
400 InvalidParameter.MatchConditions.AsPathsMatch The specified parameter "MatchConditions.AsPathsMatch" is invalid. The specified parameter "MatchConditions.AsPathsMatch" is invalid.
400 InvalidParameter.MatchConditions.AsPathsInclude The specified parameter "MatchConditions.AsPathsInclude" is invalid. The specified parameter "MatchConditions.AsPathsInclude" is invalid.
400 InvalidParameter.MatchConditions.SourceInstanceTypes The specified parameter "MatchConditions.SourceInstanceTypes" is invalid. The specified parameter "MatchConditions.SourceInstanceTypes" is invalid.
400 InvalidParameter.MatchConditions.DestinationInstanceTypes The specified parameter "MatchConditions.DestinationInstanceTypes" is invalid. The specified parameter "MatchConditions.DestinationInstanceTypes" is invalid.
400 InvalidParameter.MatchConditions.MatchAddressType The specified parameter "MatchConditions.MatchAddressType" is invalid. The specified parameter "MatchConditions.MatchAddressType" is invalid.
400 InvalidParameter.MatchConditions.RouteTypes The specified parameter "MatchConditions.RouteTypes" is invalid. The specified parameter "MatchConditions.RouteTypes" is invalid.
400 InvalidParameter.SetActions.RouteAction The specified parameter "SetActions.RouteAction" is invalid. The specified parameter "SetActions.RouteAction" is invalid.
400 ParamExclusive.AsPathPrependAndAsPathReplace Parameter AsPathPrepend And AsPathReplace are mutually exclusive. Parameter AsPathPrepend And AsPathReplace are mutually exclusive.
400 ParamExclusive.CommunityAddAndCommunityReplace Parameter CommunityAdd And CommunityReplace are mutually exclusive. Parameter CommunityAdd And CommunityReplace are mutually exclusive.
400 InvalidParameter.SetActions.AsPathReplace The specified parameter "SetActions.AsPathReplace" is invalid. The specified parameter "SetActions.AsPathReplace" is invalid.
400 InvalidParameter.SetActions.AsPathPrepend The specified parameter "SetActions.AsPathPrepend" is invalid. The specified parameter "SetActions.AsPathPrepend" is invalid.
400 InvalidParameter.SetActions.CommunityAdd The specified parameter "SetActions.CommunityAdd" is invalid. The specified parameter "SetActions.CommunityAdd" is invalid.
400 InvalidParameter.SetActions.CommunityReplace The specified parameter "SetActions.CommunityReplace" is invalid. The specified parameter "SetActions.CommunityReplace" is invalid.
400 InvalidParameter.SetActions.NextPriority The specified parameter "SetActions.NextPriority" is invalid. The specified parameter "SetActions.NextPriority" is invalid.
400 InvalidParameter.RouteMapId The specified parameter RouteMapId is invalid. The parameter RouteMapId entered is illegal.

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.