Creates a routing policy for a CEN instance.

Usage notes

You can configure routing policies to filter and modify routes. This allows you to manage network communication in the cloud.

Routing policies are sorted by priority. A smaller value indicates a higher priority. Each routing policy is a collection of conditional statements and execution statements. Starting from the routing policy with the highest priority, the system matches routes against the match conditions specified by routing policies. If a route meets all the match conditions of a routing policy, the system permits or denies the route based on the action specified by the routing policy. You can also modify the attributes of permitted routes. By default, the system permits routes that meet none of the match conditions. For more information, see Routing policy overview.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter Type Required Example Description
Action String Yes CreateCenRouteMap

The operation that you want to perform. Set the value to CreateCenRouteMap.

CenId String Yes cen-7qthudw0ll6jmc****

The ID of the CEN instance.

CenRegionId String Yes cn-hangzhou

The ID of the region where the routing policy is applied.

You can call the DescribeChildInstanceRegions operation to query the most recent region list.

TransmitDirection String Yes RegionIn

The direction in which the routing policy is applied. Valid values:

  • RegionIn: Routes are advertised to the gateways in the regions that are connected by the CEN instance.

    For example, routes are advertised from network instances deployed in the current region or other regions to the gateway deployed in the current region.

  • RegionOut: Routes are advertised from the gateways in the regions that are connected by the CEN instance.

    For example, routes are advertised from the gateway deployed in the current region to network instances deployed in the same region, or to gateways deployed in other regions.

Description String No desctest

Enter a description for the routing policy.

The description must be 2 to 256 characters in length, and can contain letters, digits, hyphens (-), periods (.), and underscores (_). It must start with a letter and cannot start with http:// or https://.

Priority Integer Yes 3

The priority of the routing policy. Valid values: 1 to 100. A smaller value indicates a higher priority.

Note You cannot specify the same priority for routing policies that apply in the same region and direction. The system matches routes against the match conditions of routing policies in descending order of priority. A smaller value indicates a higher priority. You must set the priorities to proper values.
MapResult String Yes Permit

The action to be performed on a route that meets all match conditions. Valid values:

  • Permit: the route is permitted.
  • Deny: the route is denied.
NextPriority Integer No 20

Specify a priority for the routing policy that you want to associate with the current one.

  • This parameter takes effect only when the MapResult parameter is set to Permit. This way, the permitted route is matched against the next routing policy.
  • The region and direction of the routing policy to be associated must be the same as those of the current routing policy.
  • The priority of the next routing policy must be lower than the priority of the current routing policy.
CidrMatchMode String No Include

The match method that is used to match routes based on the prefix. Valid values:

  • Include: fuzzy match. A route is a match if the route prefix is included in the match conditions.

    For example, if you set the match condition to 10.10.0.0/16 and fuzzy match is enabled, the route whose prefix is 10.10.1.0/24 is a match.

  • Complete: exact match. A route is a match only if the route prefix is the same as the prefix specified in the match condition.

    For example, if you set the match condition to 10.10.0.0/16 and exact match is enabled, a route is a match only if the prefix is 10.10.0.0/16.

AsPathMatchMode String No Include

The match method that is used to match routes based on the AS path. Valid values:

  • Include: fuzzy match. A route is a match if the AS path of the route overlaps with the AS path specified in the match condition.
  • Complete: exact match. A route is a match only if the AS path of the route is the same as the AS path specified in the match condition.
CommunityMatchMode String No Include

The match method that is used to match routes based on the community. Valid values:

  • Include: fuzzy match. A route is a match if the community of the route overlaps with the community specified in the match condition.
  • Complete: exact match. A route is a match only if the community of the route is the same as the community specified in the match condition.
CommunityOperateMode String No Additive

The action that is performed on the community of the route. Valid values:

  • Additive: adds the community to the route.
  • Replace: replaces the original community of the route.

This parameter specifies the action to be performed when a route meets the match condition.

Preference Integer No 50

The new priority of the route.

Valid values: 1 to 100. The default priority is 50. A smaller value indicates a higher priority.

This parameter specifies the action to be performed when a route meets the match condition.

SourceInstanceIdsReverseMatch Boolean No false

Specifies whether to exclude the source network instance IDs. Valid values:

  • false (default value): A route is a match if its source network instance ID is in the list specified by SourceInstanceIds.N.
  • true: A route is a match if its source network instance ID is not in the list specified by SourceInstanceIds.N.
DestinationInstanceIdsReverseMatch Boolean No false

Specifies whether to exclude the destination network instance IDs. Valid values:

  • false (default value): A route is a match if its destination network instance ID is in the list specified by DestinationInstanceIds.N.
  • true: A route is a match if its destination network instance ID is not in the list specified by DestinationInstanceIds.N.
TransitRouterRouteTableId String No vtb-gw8nx3515m1mbd1z1****

The ID of the route table of the transit router.

If you do not specify a route table ID, the routing policy is automatically associated with the default route table of the transit router.

SourceInstanceIds.N String No vpc-adeg3544fdf34vf****

The IDs of the source network instances to which the routes belong. The following network instance types are supported:

  • Virtual private cloud (VPC)
  • Virtual border router (VBR)
  • Cloud Connect Network (CCN) instance
  • Smart Access Gateway (SAG) instance

You can enter at most 32 network instance IDs.

DestinationInstanceIds.N String No vpc-afrfs434465fdf****

The IDs of the destination network instances to which the routes belong. The following network instance types are supported:

  • VPC
  • VBR
  • CCN instance
  • SAG instance

You can enter at most 32 network instance IDs.

Note The destination network instance IDs are valid only when the routing policy is applied to scenarios where routes are advertised from the gateway in the current region to network instances in the current region.
SourceRouteTableIds.N String No vtb-adfr233vf34rvd4****

The IDs of the source route tables to which the routes belong. You can enter at most 32 route table IDs.

DestinationRouteTableIds.N String No vtb-adefrgtr144vf****

The IDs of the destination route tables to which the routes belong. You can enter at most 32 route table IDs.

Note The destination route table IDs are valid only when the routing policy is applied to scenarios where routes are advertised from the gateway in the current region to route tables in the current region.
SourceRegionIds.N String No cn-beijing

The IDs of the source regions to which the routes belong. You can enter at most 32 region IDs.

You can call the DescribeChildInstanceRegions operation to query the most recent region list.

SourceChildInstanceTypes.N String No VPC

The types of source network instances to which the routes belong. The following types of network instances are supported:

  • VPC: VPC
  • VBR: VBR
  • CCN: CCN instance

You can specify one or more network instance types.

DestinationChildInstanceTypes.N String No VPC

The types of destination network instances to which the routes belong. The following types of network instances are supported:

  • VPC: VPC
  • VBR: VBR
  • CCN: CCN instance

You can specify one or more network instance types.

Note The destination network instance types are valid only when the routing policy is applied to scenarios where routes are advertised from the gateway in the current region to network instances in the current region.
DestinationCidrBlocks.N String No 10.10.10.0/24

The prefixes of the routes.

You must specify the IP addresses in CIDR notation. You can enter at most 32 CIDR blocks.

RouteTypes.N String No System

The type of route to be compared. Valid values: The following route types are supported:

  • System: system routes that are automatically generated by the system.
  • Custom: custom routes that are manually added.
  • BGP: routes that are advertised over Border Gateway Protocol (BGP).

You can specify multiple route types.

MatchAsns.N Long No 65501

The AS paths based on which routes are compared.

You can specify at most 32 AS numbers.

Note Only the AS-SEQUENCE parameter is supported. The AS-SET, AS-CONFED-SEQUENCE, and AS-CONFED-SET parameters are not supported. In other words, only the AS number list is supported. Sets and sub-lists are not supported.
MatchCommunitySet.N String No 65501:1

The community set based on which routes are compared.

Specify the community in the format of n:m. Valid values of n and m: 1 to 65535. Each community must comply with the RFC 1997 standard. The RFC 8092 standard that defines Border Gateway Protocol (BGP) large communities is not supported.

You can specify at most 32 communities.

Note If the configurations of the communities are incorrect, routes may fail to be advertised to your data center.
OperateCommunitySet.N String No 65501:1

The community set on which actions are performed.

Specify the community in the format of n:m. Valid values of n and m: 1 to 65535. Each community must comply with RFC 1997. The RFC 8092 standard that defines BGP large communities is not supported.

You can specify at most 32 communities.

Note If the configurations of the communities are incorrect, routes may fail to be advertised to your data center.
PrependAsPath.N Long No 65501

The AS paths that are prepended by using an action statement when regional gateways receive or advertise routes.

The AS paths vary based on the direction in which the routing policy is applied:

  • If AS paths are prepended to a routing policy that is applied in the inbound direction, you must specify source network instance IDs and the source region in the match condition. In addition, the source region must be the same as the region where the routing policy is applied.
  • If AS paths are prepended to a routing policy that is applied in the outbound direction, you must specify destination network instance IDs in the match condition.

This parameter specifies the action to be performed when a route meets the match condition. You can specify at most 32 AS numbers.

Response parameters

Parameter Type Example Description
RouteMapId String cenrmap-w4yf7toozfol3q****

The ID of the routing policy.

RequestId String 62172DD5-6BAC-45DF-8D44-56SDF467BAC

The ID of the request.

Examples

Sample request

http(s)://[Endpoint]/?Action=CreateCenRouteMap
&CenId=cen-7qthudw0ll6jmc****
&CenRegionId=cn-hangzhou
&Priority=3
&TransmitDirection=RegionIn
&MapResult=Permit
&<Common request parameters>

Sample success responses

XML format

HTTP/1.1 200 OK
Content-Type:application/xml

<CreateCenRouteMapResponse>
<RequestId>62172DD5-6BAC-45DF-8D44-56SDF467BAC</RequestId>
<RouteMapId>cenrmap-w4yf7toozfol3q****</RouteMapId>
</CreateCenRouteMapResponse>

JSON format

HTTP/1.1 200 OK
Content-Type:application/json

{
  "RequestId" : "62172DD5-6BAC-45DF-8D44-56SDF467BAC",
  "RouteMapId" : "cenrmap-w4yf7toozfol3q****"
}

Error codes

HttpCode Error code Error message Description
400 Forbidden.CenRouteMapExist The specified CEN route map ID already exists. The error message returned because the routing policy already exists.
400 InvalidOperation.NoEffictiveAction No effective action be configured. The error message returned because the specified action is invalid.

For a list of error codes, visit the API Error Center.