Create a listener for your GA instance.
Operation description
Note the following when you call this operation:
- CreateListener is an asynchronous operation. After you send a request, the system returns a listener ID but the listener is still being created in the background. You can call DescribeListener to check the listener's status:
An init status indicates that the listener is being created. In this state, you can only perform query operations.
An active status indicates that the listener is ready.
You cannot concurrently create multiple listeners for the same Global Accelerator instance by using the CreateListener operation.
Try it now
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
ga:CreateListener |
create |
*Listener
*Accelerator
|
|
None |
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| RegionId |
string |
Yes |
The region ID of the Global Accelerator instance. Set the value to cn-hangzhou. |
cn-hangzhou |
| ClientToken |
string |
No |
A client token that ensures the idempotence of the request. Generate a unique token on your client for each request. The token must contain only ASCII characters. Note
If you omit this parameter, the system uses the request's RequestId as the ClientToken. |
123e4567-e89b-12d3-a456-426655440000 |
| AcceleratorId |
string |
Yes |
The ID of the Global Accelerator instance. |
ga-bp1odcab8tmno0hdq**** |
| Name |
string |
No |
The name of the listener. The name must be 1 to 128 characters long, start with a letter or a Chinese character, and can contain digits, periods (.), underscores (_), and hyphens (-). |
Listener |
| Description |
string |
No |
The description of the listener. The description can be up to 200 characters long and cannot start with |
Listener |
| ClientAffinity |
string |
No |
The client affinity for the listener.
|
SOURCE_IP |
| Protocol |
string |
No |
The listener's network protocol. Valid values:
|
tcp |
| PortRanges |
array<object> |
Yes |
The listener port range. The port numbers must be within the range of 1 to 65499. The maximum number of allowed ports depends on the listener's routing type and protocol. For more information, see Listener ports. |
|
|
object |
No |
The listener port range. The port numbers must be within the range of 1 to 65499. The maximum number of allowed ports depends on the listener's routing type and protocol. For more information, see Listener ports. |
||
| FromPort |
integer |
Yes |
The first port in the listener range used to receive and forward requests to endpoints. The port number must be in the range of 1 to 65499, and the value of FromPort must be less than or equal to the value of ToPort. Note
For HTTP or HTTPS listeners, you can specify only one listener port. In this case, the value of FromPort must be the same as the value of ToPort. |
20 |
| ToPort |
integer |
Yes |
The last port in the listener range used to receive and forward requests to endpoints. The port number must be in the range of 1 to 65499, and the value of FromPort must be less than or equal to the value of ToPort. Note
For HTTP or HTTPS listeners, you can specify only one listener port. In this case, the value of FromPort must be the same as the value of ToPort. |
20 |
| Certificates |
array<object> |
No |
The SSL certificates for an HTTPS listener. |
|
|
object |
No |
The SSL certificates for an HTTPS listener. |
||
| Id |
string |
No |
The ID of the SSL certificate. Note
This parameter is required only for HTTPS listeners. |
449****-cn-hangzhou |
| XForwardedForConfig |
object |
No |
Settings for |
|
| XForwardedForGaIdEnabled |
boolean |
No |
Specifies whether to use the
Note
This parameter applies only to HTTP and HTTPS listeners. |
false |
| XForwardedForGaApEnabled |
boolean |
No |
Specifies whether to use the
Note
This parameter applies only to HTTP and HTTPS listeners. |
false |
| XForwardedForProtoEnabled |
boolean |
No |
Specifies whether to use the
Note
This parameter applies only to HTTP and HTTPS listeners. |
false |
| XForwardedForPortEnabled |
boolean |
No |
Specifies whether to use the
Note
This parameter applies only to HTTP and HTTPS listeners. |
false |
| XRealIpEnabled |
boolean |
No |
Specifies whether to use the
Note
This parameter applies only to HTTP and HTTPS listeners. |
false |
| SecurityPolicyId |
string |
No |
The ID of the security policy. Valid values:
Note
This parameter applies only to HTTPS listeners. |
tls_cipher_policy_1_0 |
| Type |
string |
No |
The routing type of the listener. Valid values:
Note
|
Standard |
| EndpointGroupConfigurations |
array<object> |
No |
The configurations of the endpoint groups for a standard listener. You can specify up to 10 endpoint groups. Note
This parameter applies only when the listener's routing type (Type) is Standard. |
|
|
array<object> |
No |
The configurations of the endpoint groups for a standard listener. You can specify up to 10 endpoint groups. Note
This parameter applies only when the listener's routing type (Type) is Standard. |
||
| EndpointGroupName |
string |
No |
The name of the endpoint group. The name must be 1 to 128 characters long, start with a letter or a Chinese character, and can contain digits, periods (.), underscores (_), and hyphens (-). You can enter up to 10 endpoint group names. Note
This parameter applies only when the listener's routing type (Type) is Standard. |
test |
| EndpointGroupDescription |
string |
No |
The description of the endpoint group. The description can be up to 200 characters long and cannot contain You can enter up to 10 endpoint group descriptions. Note
This parameter applies only when the listener's routing type (Type) is Standard. |
test |
| EndpointGroupRegion |
string |
No |
The ID of the region where the endpoint group is created. You can enter up to 10 endpoint group region IDs. Note
This parameter applies only when the listener's routing type (Type) is Standard. |
cn-hangzhou |
| TrafficPercentage |
integer |
No |
The traffic distribution ratio. If a standard listener is associated with multiple endpoint groups, this parameter specifies the percentage of traffic that is distributed to each endpoint group. Valid values: 1 to 100. Default value: 100. You can enter traffic distribution values for up to 10 endpoint groups. Note
This parameter applies only when the listener's routing type (Type) is Standard. |
100 |
| HealthCheckEnabled |
boolean |
No |
Specifies whether to enable health checks for the endpoint group. Valid values:
You can enable health checks for up to 10 endpoint groups. Note
This parameter applies only when the listener's routing type (Type) is Standard. |
false |
| HealthCheckIntervalSeconds |
integer |
No |
The health check interval, in seconds. You can enter up to 10 health check intervals. Note
This parameter applies only when the listener's routing type (Type) is Standard. |
3 |
| HealthCheckPath |
string |
No |
The path to which health check requests are sent. You can enter up to 10 health check paths. Note
This parameter applies only when the listener's routing type (Type) is Standard. |
/healthcheck |
| HealthCheckPort |
integer |
No |
The port that is used for health checks. Valid values: 1 to 65535. You can enter a maximum of 10 ports for health checks. Note
This parameter applies only when the listener's routing type (Type) is Standard. |
20 |
| HealthCheckProtocol |
string |
No |
The protocol over which health check requests are sent. Valid values:
You can enter up to 10 health check protocols. Note
This parameter applies only when the listener's routing type (Type) is Standard. |
tcp |
| ThresholdCount |
integer |
No |
The number of consecutive successful health checks required to mark an endpoint as healthy, or consecutive failed health checks to mark an endpoint as unhealthy. Valid values: 2 to 10. Default value: 3. You can enter up to 10 values for the number of consecutive health checks required to trigger a health status change. Note
This parameter applies only when the listener's routing type (Type) is Standard. |
3 |
| EndpointConfigurations |
array<object> |
No |
The endpoint configurations. |
|
|
object |
No |
The endpoint configurations. |
||
| Type |
string |
No |
The type of the endpoint. Valid values:
You can specify up to 100 endpoints in an endpoint group. Note
Note
For more information, see Service-linked roles. |
Ip |
| Weight |
integer |
No |
The weight of the endpoint. Valid values: 0 to 255. In an endpoint group for an intelligent routing type listener, you can enter weights for up to 100 endpoints. Note
|
20 |
| Endpoint |
string |
No |
The IP address or domain name of the endpoint. In an endpoint group of an intelligent routing listener, you can enter up to 100 IP addresses or domain names of endpoints. Note
This parameter applies only when the listener's routing type (Type) is Standard. |
47.0.XX.XX |
| SubAddress |
string |
No |
The private IP address of the ENI. Note
If the endpoint type is ENI, you can specify this parameter. If you do not specify this parameter, the primary private IP address of the ENI is used. |
172.168.XX.XX |
| EnableClientIPPreservation |
boolean |
No |
Specifies whether to preserve client source IP addresses. Valid values:
Note
|
|
| EnableProxyProtocol |
boolean |
No |
Specifies whether to use the proxy protocol to preserve client source IP addresses. Valid values:
Note
|
|
| VpcId |
string |
No |
The ID of the Virtual Private Cloud (VPC). In an endpoint group of an intelligent routing listener, you can enter a maximum of 1 VPC ID. Note
This parameter is required only for IpTarget endpoints. |
vpc-bp13r1kpr2lel**** |
| VSwitchIds |
array |
No |
The list of vSwitches in the VPC. You can specify up to two vSwitch IDs. |
|
|
string |
No |
The ID of the vSwitch. In an endpoint group for a smart routing type listener, you can enter a maximum of 2 vSwitch IDs. Note
This parameter is required only for IpTarget endpoints.
|
vsw-0jlhcznhw5m7pz2fa**** |
|
| Provider |
string |
No |
BAILIAN |
|
| ApiKeys |
array |
No |
||
|
string |
No |
sk-****** |
||
| EndpointRequestProtocol |
string |
No |
The protocol used by the backend service. Valid values:
You can enter up to 10 backend service protocols. Note
|
HTTP |
| EndpointProtocolVersion |
string |
No |
The protocol version of the backend service. Valid values:
Note
This parameter is available only when EndpointRequestProtocol is set to HTTPS. |
HTTP1.1 |
| EndpointGroupType |
string |
No |
The type of the endpoint group. Valid values:
You can enter up to 10 endpoint group types. Note
|
default |
| PortOverrides |
array<object> |
No |
The port mapping. You can specify up to five port mappings. |
|
|
object |
No |
The port mapping. |
||
| ListenerPort |
integer |
No |
The listener port that is specified in the port mapping. You can enter up to 5 listener ports for port mappings. Note
|
443 |
| EndpointPort |
integer |
No |
The endpoint port that is specified in the port mapping. You can enter a maximum of 5 endpoint ports for port mapping. Note
|
80 |
| HealthCheckHost |
string |
No |
The domain name that is used for health checks. |
www.taobao.com |
| EndpointIpVersion |
string |
No |
The IP version used by the backend service. Valid values:
|
IPv4 |
| CustomRoutingEndpointGroupConfigurations |
array<object> |
No |
The configurations of the endpoint groups for a custom routing listener. You can specify up to five endpoint groups. Note
This parameter applies only when the listener's routing type (Type) is CustomRouting. |
|
|
array<object> |
No |
The configurations of the endpoint groups for a custom routing listener. You can specify up to five endpoint groups. Note
This parameter applies only when the listener's routing type (Type) is CustomRouting. |
||
| EndpointGroupRegion |
string |
No |
The ID of the region where the endpoint group is created. You can enter up to 5 endpoint group region IDs. Note
This parameter applies only when the listener's routing type (Type) is CustomRouting. |
cn-hangzhou |
| Name |
string |
No |
The name of the endpoint group. The name must be 1 to 128 characters long, start with a letter or a Chinese character, and can contain digits, periods (.), underscores (_), and hyphens (-). You can enter up to 5 endpoint group names. Note
This parameter applies only when the listener's routing type (Type) is CustomRouting. |
test |
| Description |
string |
No |
The description of the endpoint group. The description can be up to 200 characters long and cannot contain You can enter up to 5 endpoint group descriptions. Note
This parameter applies only when the listener's routing type (Type) is CustomRouting. |
test |
| DestinationConfigurations |
array<object> |
No |
The mapping configurations for the endpoint group. You must specify the port ranges and protocols for the backend service. The settings are mapped to the associated listener port ranges. You can specify up to 20 mapping configurations for each endpoint group. Note
This parameter applies only when the listener's routing type (Type) is CustomRouting. |
|
|
object |
No |
The mapping configurations for the endpoint group. You must specify the port ranges and protocols for the backend service. The settings are mapped to the associated listener port ranges. You can specify up to 20 mapping configurations for each endpoint group. Note
This parameter applies only when the listener's routing type (Type) is CustomRouting. |
||
| Protocols |
array |
No |
The protocols of the backend service. You can specify up to four backend service protocols for each mapping configuration. Note
This parameter applies only when the listener's routing type (Type) is CustomRouting. |
|
|
string |
No |
The protocol of the backend service. Valid values:
For each endpoint group of a listener that uses the custom routing type, you can specify up to four backend service protocol types in the port mapping and protocol type settings. Note
This parameter applies only when the listener's routing type (Type) is CustomRouting. |
TCP |
|
| FromPort |
integer |
No |
The first port of the backend service. The valid port range is 1 to 65499. The value of FromPort must be less than or equal to the value of ToPort. In each endpoint group for a custom routing type listener, you can enter up to 20 backend service starting ports. Note
This parameter applies only when the listener's routing type (Type) is CustomRouting. |
80 |
| ToPort |
integer |
No |
The last port of the backend service. The valid port range is 1 to 65499. The value of FromPort must be less than or equal to the value of ToPort. In each endpoint group of a listener of the custom routing type, you can enter a maximum of 20 backend service ports. Note
This parameter applies only when the listener's routing type (Type) is CustomRouting. |
80 |
| EndpointConfigurations |
array<object> |
No |
The endpoint configurations. You can specify up to 10 endpoints for each endpoint group. Note
This parameter applies only when the listener's routing type (Type) is CustomRouting. |
|
|
array<object> |
No |
The endpoint configurations. You can specify up to 10 endpoints for each endpoint group. Note
This parameter applies only when the listener's routing type (Type) is CustomRouting. |
||
| Type |
string |
No |
The type of the backend service for a custom routing listener. Valid value: PrivateSubNet (default): a private CIDR block. Note
This parameter applies only when the listener's routing type (Type) is CustomRouting. |
PrivateSubNet |
| Endpoint |
string |
No |
The vSwitch of the custom routing listener. Note
This parameter applies only when the listener's routing type (Type) is CustomRouting. |
vsw-test01 |
| TrafficToEndpointPolicy |
string |
No |
The traffic policy for the backend service of a custom routing listener. Valid values:
Note
This parameter applies only when the listener's routing type (Type) is CustomRouting. |
DenyAll |
| PolicyConfigurations |
array<object> |
No |
The destination configurations for a custom routing listener. You can specify up to 20 destinations for each endpoint. Note
This parameter applies only when the listener's routing type (Type) is CustomRouting. |
|
|
array<object> |
No |
The destination configurations for a custom routing listener. You can specify up to 20 destinations for each endpoint. Note
This parameter applies only when the listener's routing type (Type) is CustomRouting. |
||
| Address |
string |
No |
The IP address of the destination that is allowed to receive traffic. This parameter is required only when TrafficToEndpointPolicy is set to AllowCustom. You can specify up to 20 destination IP addresses for each endpoint. Note
This parameter applies only when the listener's routing type (Type) is CustomRouting. |
10.0.XX.XX |
| PortRanges |
array<object> |
No |
The port range of the destination that is allowed to receive traffic. The port range must be within the port range of the backend service. If you leave this parameter empty, all ports of the destination are allowed. This parameter is required only when TrafficToEndpointPolicy is set to AllowCustom. You can specify up to 20 port ranges for each endpoint, and up to 5 port ranges for each destination. Note
This parameter applies only when the listener's routing type (Type) is CustomRouting. |
|
|
object |
No |
The port range of the destination that is allowed to receive traffic. The port range must be within the port range of the backend service. If you leave this parameter empty, all ports of the destination are allowed. This parameter is required only when TrafficToEndpointPolicy is set to AllowCustom. You can specify up to 20 port ranges for each endpoint, and up to 5 port ranges for each destination. Note
This parameter applies only when the listener's routing type (Type) is CustomRouting. |
||
| FromPort |
integer |
No |
The first port of the destination that is allowed to receive traffic. The port must be within the port range of the backend service. This parameter is required only when TrafficToEndpointPolicy is set to AllowCustom. You can specify up to 20 port ranges for each endpoint, and up to 5 first ports for each destination. Note
This parameter applies only when the listener's routing type (Type) is CustomRouting. |
80 |
| ToPort |
integer |
No |
The last port of the destination that is allowed to receive traffic. The port must be within the port range of the backend service. This parameter is required only when TrafficToEndpointPolicy is set to AllowCustom. You can specify up to 20 port ranges for each endpoint, and up to 5 last ports for each destination. Note
This parameter applies only when the listener's routing type (Type) is CustomRouting. |
80 |
| IdleTimeout |
integer |
No |
The connection idle timeout, in seconds.
|
900 |
| RequestTimeout |
integer |
No |
The request timeout for HTTP/HTTPS connections, in seconds. Valid values: 1–180 seconds. Default: 60 seconds. Note
This parameter applies only to HTTP or HTTPS listeners. If the backend server does not respond within the timeout period, Global Accelerator returns an HTTP 504 error to the client. |
15 |
| HttpVersion |
string |
No |
The maximum HTTP version. Valid values:
Note
This parameter applies only to HTTPS listeners. |
http2 |
Response elements
|
Element |
Type |
Description |
Example |
|
object |
The data returned for the request. |
||
| RequestId |
string |
The request ID. |
04F0F334-1335-436C-A1D7-6C044FE73368 |
| ListenerId |
string |
The ID of the created listener. |
lsr-bp1bpn0kn908w4nbw**** |
Examples
Success response
JSON format
{
"RequestId": "04F0F334-1335-436C-A1D7-6C044FE73368",
"ListenerId": "lsr-bp1bpn0kn908w4nbw****"
}
Error codes
|
HTTP status code |
Error code |
Error message |
Description |
|---|---|---|---|
| 400 | Resource.QuotaFull | The resource quota is exceeded. | The number of resources has reached the upper limit. |
| 400 | ProtocalIllegal.Listener | The specified listener protocol is invalid. | The specified listener protocol is invalid. |
| 400 | NotExist.Accelerator | The accelerated instance does not exist. | The GA instance does not exist. |
| 400 | StateError.Accelerator | The state of the accelerated instance is invalid. | The status of the GA instance is invalid. |
| 400 | QuotaExceeded.Listener | The maximum number of listeners is exceeded. | The maximum number of listeners is exceeded. |
| 400 | QuotaExceeded.ListenerPort | The maximum number of listener ports is exceeded. | The maximum number of listener ports is exceeded. |
| 400 | NotExist.ListenerPort | listener port %s is not exist | |
| 400 | PortRangeIllegal.Listener | The specified listener port range is invalid. | The specified listener port range is invalid. |
| 400 | PortRangeIllegal.Count | The hugePort listener only supports one port range. | The mass port listener (port number greater than 300) only supports one port range. |
| 400 | PortConflict.Listener | The listener port configuration is in conflict. | The listener port configurations are in conflict. |
| 400 | PortRangeIllegal.ExceedGaAbility | The listener port range is invalid. For each accelerator instance, you can only create a listener with port range over 300 for each protocol (TCP and UDP). | The listener port range is invalid. For each accelerator instance, you can only create a listener with port range over 300 for each protocol (TCP and UDP). |
| 400 | PortRangeIllegal.UDP | UDP ports 250, 4789, and 4790 are system reserved ports. | |
| 400 | SystemPort.Listener | Ports 65500-65535 are system reserved ports. | Ports 65500 to 65535 are reserved by the system. |
| 400 | PortRanges.MustOne | The portRanges must be one for HTTPS and HTTP type listener. | Only one port is supported for HTTPS and HTTP type listeners. |
| 400 | SecurityPolicyId.NotNeed | No security policy ID is required for the listener. | No security policy ID is required for the listener. |
| 400 | SecurityPolicyIdIllegal.Listener | The listener security policy ID %s is illegal. | The security policy ID of the listener is invalid. |
| 500 | UnknownError | An error occurred while processing your request. Please try again. If the error persists, please submit a ticket. | An error occurred while the request was being processed. Try again later. |
| 403 | Forbbiden.SubUser | You are not authorized to operate on the specified resource because your account was created by another user. | The current account is a RAM user and does not have permissions to manage the specified resources. |
| 403 | Forbidden | The user is not authorized to operate on the specified resource. | The current account does not have permissions to manage the specified resources. |
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.