Creates traffic destinations of endpoints for a custom routing listener.

Usage notes

This operation takes effect only when the traffic access policy of an endpoint allows traffic to specified destinations. You can call the DescribeCustomRoutingEndpoint operation to query the traffic access policy of an endpoint. The CreateCustomRoutingEndpointTrafficPolicies operation takes effect only when TrafficToEndpointPolicy of an endpoint is set to AllowCustom.

When you call this operation, take note of the following items:

  • CreateCustomRoutingEndpointTrafficPolicies is an asynchronous operation. After you send a request, the system returns a request ID and runs the task in the background. You can call the DescribeCustomRoutingEndpointGroup operation to query the status of an endpoint group to check whether traffic destinations are created for an endpoint in the endpoint group.
    • If the endpoint group is in the updating state, traffic destinations are being created. In this case, you can perform only query operations.
    • If the endpoint group is in the active state, traffic destinations are created.
  • You cannot repeatedly call the CreateCustomRoutingEndpointTrafficPolicies operation for the same Global Accelerator (GA) instance within a specific period of time.

Prerequisites

Before you call this operation, make sure that the following requirements are met:

  • A standard GA instance is created. For more information, see CreateAccelerator.
  • A bandwidth plan is associated with the standard GA instance. For more information, see BandwidthPackageAddAccelerator.
  • An application is deployed as an endpoint to receive requests that are forwarded from GA. You can specify only vSwitches as endpoints for custom routing listeners.
  • The permissions to use custom routing listeners are acquired and a custom routing listener is created for the GA instance. Custom routing listeners are in invitational preview. To use custom routing listeners, contact your account manager. For more information about how to create a custom routing listener, see CreateListener.
  • Endpoint groups are created for the custom routing listener. For more information, see CreateCustomRoutingEndpointGroups.
  • Endpoints are created for the custom routing listener. For more information, see CreateCustomRoutingEndpoints.

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 CreateCustomRoutingEndpointTrafficPolicies

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

RegionId String Yes cn-hangzhou

The ID of the region where the GA instance is deployed. Set the value to cn-hangzhou.

ClientToken String No 123e4567-e89b-12d3-a456-426655440000

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

You can use the client to generate the value, but you must ensure that it is unique among all requests. The token can contain only ASCII characters.

Note If you do not set this parameter, the system sets ClientToken to the value of RequestId. The value of RequestId for each API request may be different.
EndpointId String Yes ep-2zewuzypq5e6r3pfh****

The ID of the endpoint for which you want to create the traffic destinations.

Note This parameter is required.
PolicyConfigurations.N.Address String No 10.0.XX.XX

The IP address of the destination to which traffic is distributed.

This parameter takes effect only when TrafficToEndpointPolicy is set to AllowCustom.

You can specify up to 500 destination IP addresses for each endpoint.

Note This parameter is required.
PolicyConfigurations.N.PortRanges.N.FromPort Integer No 80

The start port of the port range of the traffic destination. The specified port must fall within the port range of the specified endpoint group.

This parameter takes effect only when TrafficToEndpointPolicy is set to AllowCustom.

If the start port and end port values are empty, traffic on all ports of the destination is allowed.

You can specify port ranges for up to 500 destinations for each endpoint and specify up to 10 start ports for each destination.

PolicyConfigurations.N.PortRanges.N.ToPort Integer No 80

The end port of the port range of the traffic destination. The specified port must fall within the port range of the specified endpoint group.

This parameter takes effect only when TrafficToEndpointPolicy is set to AllowCustom.

If the start port and end port values are empty, traffic on all ports of the destination is allowed.

You can specify port ranges for up to 500 destinations for each endpoint and specify up to 10 end ports for each destination.

Response parameters

Parameter Type Example Description
RequestId String 04F0F334-1335-436C-A1D7-6C044FE73368

The ID of the request.

PolicyIds Array of String ply-bptest2****

The IDs of the traffic destinations.

Examples

Sample requests

http(s)://[Endpoint]/?Action=CreateCustomRoutingEndpointTrafficPolicies
&RegionId=cn-hangzhou
&ClientToken=123e4567-e89b-12d3-a456-426655440000
&EndpointId=ep-2zewuzypq5e6r3pfh****
&PolicyConfigurations=[{"Address":"10.0.XX.XX","PortRanges":[{"FromPort":80,"ToPort":80}]}]
&<Common request parameters>

Sample success responses

XML format

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

<CreateCustomRoutingEndpointTrafficPoliciesResponse>
    <RequestId>04F0F334-1335-436C-A1D7-6C044FE73368</RequestId>
    <PolicyIds>ply-bptest2****</PolicyIds>
</CreateCustomRoutingEndpointTrafficPoliciesResponse>

JSON format

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

{
  "RequestId" : "04F0F334-1335-436C-A1D7-6C044FE73368",
  "PolicyIds" : [ "ply-bptest2****" ]
}

Error codes

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