CreateRouteMapRule

Updated at:

Creates a route map rule.

Operation description

Request description

  • RouteMapId is a required parameter used to specify the route map to which the new rule belongs.

  • Priority is a required parameter. A smaller value indicates a higher priority. Rule priorities within the same route map must be unique.

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

  • MatchConditions is used to define the match conditions of the rule, and SetActions is used to define the actions to be performed after 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

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

cen:CreateRouteMapRule

create

*RouteMapRule

acs:cen:*:{#accountId}:routemaprule/*

*RouteMap

acs:cen:*:{#accountId}:routemap/{#RouteMapId}

None None

Request syntax

POST / HTTP/1.1

Request parameters

Parameter

Type

Required

Description

Example

ClientToken

string

No

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

Generate the value from your client and ensure it is unique across different requests. The client token can contain 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 left empty or be 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 left empty or be 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 is valid, and service limits are met. 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. If 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 performs the actions defined in SetActions only after a route meets all the match conditions defined in this parameter.

AddressPrefixesInclude

array

No

The route prefix list for fuzzy matching. You can specify up to 64 IP address segments.

A route is considered matched 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 segments use the CIDR format, and support IPv4 and IPv6.

This parameter is mutually exclusive with AddressPrefixesMatch and cannot be specified at the same time.

string

No

The route prefix list for fuzzy matching. You can specify up to 64 IP address segments.

A route is considered matched 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 segments use the CIDR format, and support IPv4 and IPv6.

This parameter is mutually exclusive with AddressPrefixesMatch and cannot be specified at the same time.

10.0.0.0/8

AddressPrefixesMatch

array

No

The route prefix list for exact matching. You can specify up to 64 IP address segments.

A route is considered matched 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 segments use the CIDR format, and support IPv4 and IPv6.

This parameter is mutually exclusive with AddressPrefixesInclude and cannot be specified at the same time.

string

No

The route prefix list for exact matching. You can specify up to 64 IP address segments.

A route is considered matched 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 segments use the CIDR format, and support IPv4 and IPv6.

This parameter is mutually exclusive with AddressPrefixesInclude and cannot be specified at the same time.

10.0.0.0/8

AsPathsInclude

array

No

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

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

This parameter is mutually exclusive with AsPathsMatch and cannot be specified 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 AS number lists are supported, and sets and sub-lists are not supported.

integer

No

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

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

This parameter is mutually exclusive with AsPathsMatch and cannot be specified 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 AS number lists are supported, and sets and sub-lists are not supported.

65000

AsPathsMatch

array

No

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

A route is considered matched 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 and cannot be specified 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 AS number lists are supported, and sets and sub-lists are not supported.

integer

No

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

A route is considered matched 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 and cannot be specified 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 AS number lists are supported, and sets and sub-lists are not supported.

65000

CommunitySetInclude

array

No

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

A route is considered matched 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 and cannot be specified 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 matching. You can specify up to 64 communities.

A route is considered matched 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 and cannot be specified 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 matching. You can specify up to 64 communities.

A route is considered matched 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 and cannot be specified 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 matching. You can specify up to 64 communities.

A route is considered matched 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 and cannot be specified 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 reverse match mode for the destination instance ID list. Valid values:

  • false (default): No. A route is matched if its destination instance ID is included in DestinationInstanceIds.N.

  • true: Yes. A route is matched if its destination instance ID is not included in DestinationInstanceIds.N.

false

DestinationInstanceTypes

array

No

The list of destination instance types to match. Valid values:

  • 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. Valid values:

  • 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.

If this parameter is left empty, all types of routes are matched.

IPv4

RouteTypes

array

No

The list of route types to match. Valid values:

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

  • Custom: custom route, which is manually added by a 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. Valid values:

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

  • Custom: custom route, which is manually added by a 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 reverse match mode for the source instance ID list. Valid values:

  • false (default): No. A route is matched if its source instance ID is included in SourceInstanceIds.N.

  • true: Yes. A route is matched if its source instance ID is not included in SourceInstanceIds.N.

false

SourceInstanceTypes

array

No

The list of source instance types to match. Valid values:

  • VPC: VPC instance.

  • VBR: VBR instance.

You can specify multiple instance types.

string

No

The list of source instance types to match. Valid values:

  • 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 be performed 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 or advertises a route. You can specify up to 64 AS numbers.

This parameter is mutually exclusive with AsPathReplace and cannot be specified 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 or advertises a route. You can specify up to 64 AS numbers.

This parameter is mutually exclusive with AsPathReplace and cannot be specified 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 or advertises a route. The original AS path of the route is replaced with the AS number list specified in this parameter. You can specify up to 64 AS numbers.

This parameter is mutually exclusive with AsPathPrepend and cannot be specified 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 or advertises a route. The original AS path of the route is replaced with the AS number list specified in this parameter. You can specify up to 64 AS numbers.

This parameter is mutually exclusive with AsPathPrepend and cannot be specified 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 and cannot be specified at the same time.

This parameter specifies the action to be performed 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 and cannot be specified at the same time.

This parameter specifies the action to be performed 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 and cannot be specified at the same time.

This parameter specifies the action to be performed 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 and cannot be specified at the same time.

This parameter specifies the action to be performed 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 permitted routes continue to match the associated next route map rule.

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

1

RouteAction

string

No

The action to be performed after all conditions are met. Valid values:

  • Permit: Permits the matched routes.

  • Deny: Denies the matched routes.

Valid values:

  • Permit :

    Permits the matched routes.

  • Deny :

    Denies the matched routes.

Permit

Response elements

Element

Type

Description

Example

object

RouteMapRuleId

string

The ID of the route map rule.

rmr-3dm13f66wtctcnydup

RequestId

string

The request ID.

EF44D7B7-6248-5A60-8A4C-A92388605A57

Examples

Success response

JSON format

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

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.
400 InvalidParameter.MatchConditions.SourceInstanceIds The specified parameter "MatchConditions.SourceInstanceIds" is invalid. The specified parameter "MatchConditions.SourceInstanceIds" is invalid.
400 InvalidParameter.SetActions.GatewayRegionId The specified parameter "SetActions.GatewayRegionId" is invalid. The specified parameter "SetActions.GatewayRegionId" is invalid.

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.