Creates a listener for a Global Accelerator (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. The listener is then created in the background. You can call the DescribeListener operation to query the state of a listener:
If the listener is in the init state, it is being created. In this state, you can only query the listener. You cannot perform other operations.
If the listener is in the active state, it is created.
The CreateListener operation does not support creating listeners for the same GA instance concurrently.
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 GA instance. Set the value to cn-hangzhou. |
cn-hangzhou |
| ClientToken |
string |
No |
The client token that is used to ensure the idempotence of the request. Generate a value for this parameter from your client. Make sure that the value is unique among different requests. The token can contain only ASCII characters. Note
If you do not specify this parameter, the system automatically uses the RequestId of the request as the ClientToken. The RequestId may be different for each request. |
123e4567-e89b-12d3-a456-426655440000 |
| AcceleratorId |
string |
Yes |
The ID of the GA instance. |
ga-bp1odcab8tmno0hdq**** |
| Name |
string |
No |
The name of the listener. The name must be 1 to 128 characters in length. It must start with a letter or a Chinese character. It can contain digits, periods (.), underscores (_), and hyphens (-). |
Listener |
| Description |
string |
No |
The description of the listener. The description can be up to 200 characters in length and cannot start with |
Listener |
| ClientAffinity |
string |
No |
Specifies whether to maintain client affinity.
|
SOURCE_IP |
| Protocol |
string |
No |
The network transmission protocol of the listener. Valid values:
|
tcp |
| PortRanges |
array<object> |
Yes |
The listener port. The valid port range is 1 to 65499. The number of ports that you can add depends on the routing type and protocol of the listener. For more information, see Listener ports. |
|
|
object |
No |
The listener port. The valid port range is 1 to 65499. The number of ports that you can add depends on the routing type and protocol of the listener. For more information, see Listener ports. |
||
| FromPort |
integer |
Yes |
The first port of the listener port range that is used to receive and forward requests to endpoints. The valid port range is 1 to 65499. The value of FromPort must be less than or equal to the value of ToPort. The number of ports that you can add depends on the routing type and protocol of the listener. For more information, see Listener ports. Note
For HTTP or HTTPS listeners, you can specify only one listener port. The start port and end port must be the same. |
20 |
| ToPort |
integer |
Yes |
The last port of the listener port range that is used to receive and forward requests to endpoints. The valid port range is 1 to 65499. The value of FromPort must be less than or equal to the value of ToPort. The number of ports that you can add depends on the routing type and protocol of the listener. For more information, see Listener ports. Note
For HTTP or HTTPS listeners, you can specify only one listener port. The start port and end port must be the same. |
20 |
| Certificates |
array<object> |
No |
The SSL certificates. |
|
|
object |
No |
The SSL certificates. |
||
| Id |
string |
No |
The ID of the SSL certificate. Note
This parameter is required only for HTTPS listeners. |
449****-cn-hangzhou |
| XForwardedForConfig |
object |
No |
The configurations of the |
|
| XForwardedForGaIdEnabled |
boolean |
No |
Specifies whether to use the
Note
This parameter is available only for HTTP and HTTPS listeners. |
false |
| XForwardedForGaApEnabled |
boolean |
No |
Specifies whether to use the
Note
This parameter is available only for HTTP and HTTPS listeners. |
false |
| XForwardedForProtoEnabled |
boolean |
No |
Specifies whether to use the
Note
This parameter is available only for HTTP and HTTPS listeners. |
false |
| XForwardedForPortEnabled |
boolean |
No |
Specifies whether to use the
Note
This parameter is available only for HTTP and HTTPS listeners. |
false |
| XRealIpEnabled |
boolean |
No |
Specifies whether to use the
Note
This parameter is available only for HTTP and HTTPS listeners. |
false |
| SecurityPolicyId |
string |
No |
The ID of the security policy. Valid values:
Note
This parameter is available only for 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 group that is associated with the smart routing listener. You can configure up to 10 endpoint groups. Note
This parameter is required only when Type is set to Standard. |
|
|
array<object> |
No |
The configurations of the endpoint group that is associated with the smart routing listener. You can configure up to 10 endpoint groups. Note
This parameter is required only when Type is set to Standard. |
||
| EndpointGroupName |
string |
No |
The name of the endpoint group that is associated with the smart routing listener. The name must be 1 to 128 characters in length, and can contain letters, digits, periods (.), underscores (_), and hyphens (-). The name must start with a letter or a Chinese character. You can specify up to 10 endpoint group names. Note
This parameter is required only when Type is set to Standard. |
test |
| EndpointGroupDescription |
string |
No |
The description of the endpoint group that is associated with the smart routing listener. The description can be up to 200 characters in length and cannot start with You can specify up to 10 endpoint group descriptions. Note
This parameter is required only when Type is set to Standard. |
test |
| EndpointGroupRegion |
string |
No |
The ID of the region where the endpoint group that is associated with the smart routing listener is deployed. You can specify up to 10 region IDs. Note
This parameter is required only when Type is set to Standard. |
cn-hangzhou |
| TrafficPercentage |
integer |
No |
The traffic distribution ratio. If a listener is associated with multiple endpoint groups, you can specify the percentage of traffic that is distributed to each endpoint group. Valid values: 1 to 100. Default value: 100. You can specify traffic distribution ratios for up to 10 endpoint groups. Note
This parameter is required only when Type is set to Standard. |
100 |
| HealthCheckEnabled |
boolean |
No |
Specifies whether to enable the health check feature for the endpoint group that is associated with the smart routing listener. Valid values:
You can enable the health check feature for up to 10 endpoint groups. Note
This parameter is required only when Type is set to Standard. |
false |
| HealthCheckIntervalSeconds |
integer |
No |
The interval at which health checks are performed. Unit: seconds. You can specify health check intervals for up to 10 endpoint groups. Note
This parameter is required only when Type is set to Standard. |
3 |
| HealthCheckPath |
string |
No |
The path to which health check requests are sent. You can specify up to 10 health check paths. Note
This parameter is required only when Type is set to Standard. |
/healthcheck |
| HealthCheckPort |
integer |
No |
The port that is used for health checks. Valid values: 1 to 65535. You can specify up to 10 health check ports. Note
This parameter is required only when Type is set to Standard. |
20 |
| HealthCheckProtocol |
string |
No |
The protocol that is used for health checks. Valid values:
You can specify up to 10 health check protocols. Note
This parameter is required only when Type is set to Standard. |
tcp |
| ThresholdCount |
integer |
No |
The number of consecutive health check failures that must occur before a healthy endpoint is considered unhealthy, or the number of consecutive health check successes that must occur before an unhealthy endpoint is considered healthy. Valid values: 2 to 10. Default value: 3. You can specify the number of consecutive health checks for up to 10 endpoint groups. Note
This parameter is required only when Type is set to Standard. |
3 |
| EndpointConfigurations |
array<object> |
No |
The configurations of the endpoint that is associated with the smart routing listener. |
|
|
object |
No |
The configurations of the endpoint that is associated with the smart routing listener. |
||
| Type |
string |
No |
The type of endpoint that is associated with the smart routing listener. Valid values:
You can specify up to 100 endpoint types for an endpoint group of a smart routing listener. Note
Note
For more information, see Service-linked roles. |
Ip |
| Weight |
integer |
No |
The weight of the endpoint that is associated with the smart routing listener. Valid values: 0 to 255. You can specify the weights of up to 100 endpoints in an endpoint group of a smart routing listener. Note
|
20 |
| Endpoint |
string |
No |
The IP address or domain name of the endpoint that is associated with the smart routing listener. You can specify up to 100 endpoint IP addresses or domain names for an endpoint group of a smart routing listener. Note
This parameter is required only when Type is set to Standard. |
47.0.XX.XX |
| SubAddress |
string |
No |
The private IP address of the ENI. Note
This parameter is available only when the endpoint type is ENI. 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 the IP addresses of clients. Valid values:
Note
|
|
| EnableProxyProtocol |
boolean |
No |
Specifies whether to use the proxy protocol to preserve client IP addresses. Valid values:
Note
|
|
| VpcId |
string |
No |
The ID of the VPC. You can specify only one VPC ID for an endpoint group of a smart routing listener. Note
This parameter is required only when the endpoint type is IpTarget. |
vpc-bp13r1kpr2lel**** |
| VSwitchIds |
array |
No |
The vSwitches in the VPC. |
|
|
string |
No |
The ID of the vSwitch. You can specify up to two vSwitch IDs for an endpoint group of a smart routing listener. Note
This parameter is required only when the endpoint type is IpTarget.
|
vsw-0jlhcznhw5m7pz2fa**** |
|
| EndpointRequestProtocol |
string |
No |
The protocol of the backend service. Valid values:
You can specify up to 10 backend service protocols. Note
|
HTTP |
| EndpointProtocolVersion |
string |
No |
The version of the backend service protocol. Valid values:
Note
This parameter is available only when EndpointRequestProtocol is set to HTTPS. |
|
| EndpointGroupType |
string |
No |
The type of the endpoint group that is associated with the smart routing listener. Valid values:
You can specify up to 10 endpoint group types. Note
|
default |
| PortOverrides |
array<object> |
No |
The port mapping. |
|
|
object |
No |
The port mapping. |
||
| ListenerPort |
integer |
No |
The listener port that is mapped to the endpoint port. You can specify up to five listener ports in a port mapping. Note
|
443 |
| EndpointPort |
integer |
No |
The endpoint port that is mapped to the listener port. You can specify up to five endpoint ports in a port mapping. Note
|
80 |
| HealthCheckHost |
string |
No |
||
| CustomRoutingEndpointGroupConfigurations |
array<object> |
No |
The configurations of the endpoint group that is associated with the custom routing listener. You can configure up to five endpoint groups. Note
This parameter is required only when Type is set to CustomRouting. |
|
|
array<object> |
No |
The configurations of the endpoint group that is associated with the custom routing listener. You can configure up to five endpoint groups. Note
This parameter is required only when Type is set to CustomRouting. |
||
| EndpointGroupRegion |
string |
No |
The ID of the region where the endpoint group of the custom routing listener is deployed. You can specify up to five region IDs. Note
This parameter is required only when Type is set to CustomRouting. |
cn-hangzhou |
| Name |
string |
No |
The name of the endpoint group that is associated with the custom routing listener. The name must be 1 to 128 characters in length, and can contain letters, digits, periods (.), underscores (_), and hyphens (-). The name must start with a letter or a Chinese character. You can specify up to five endpoint group names. Note
This parameter is required only when Type is set to CustomRouting. |
test |
| Description |
string |
No |
The description of the endpoint group that is associated with the custom routing listener. The description can be up to 200 characters in length and cannot start with You can specify up to five endpoint group descriptions. Note
This parameter is required only when Type is set to CustomRouting. |
test |
| DestinationConfigurations |
array<object> |
No |
The mapping configurations of the endpoint group that is associated with the custom routing listener. You must specify the backend service port range and protocol. The settings are mapped to the associated listener port range. You can specify up to 20 mapping configurations for each endpoint group of a custom routing listener. Note
This parameter is required only when Type is set to CustomRouting. |
|
|
object |
No |
The mapping configurations of the endpoint group that is associated with the custom routing listener. You must specify the backend service port range and protocol. The settings are mapped to the associated listener port range. You can specify up to 20 mapping configurations for each endpoint group of a custom routing listener. Note
This parameter is required only when Type is set to CustomRouting. |
||
| Protocols |
array |
No |
The protocol of the backend service. You can specify up to four backend service protocols for each mapping configuration of an endpoint group of a custom routing listener. Note
This parameter is required only when Type is set to CustomRouting. |
|
|
string |
No |
The protocol of the backend service. Valid values:
You can specify up to four backend service protocols for each mapping configuration of an endpoint group of a custom routing listener. Note
This parameter is required only when Type is set to CustomRouting. |
TCP |
|
| FromPort |
integer |
No |
The first port of the backend service port range of the endpoint group that is associated with the custom routing listener. The valid port range is 1 to 65499. The value of FromPort must be less than or equal to the value of ToPort. You can specify up to 20 start ports of backend service port ranges for each endpoint group of a custom routing listener. Note
This parameter is required only when Type is set to CustomRouting. |
80 |
| ToPort |
integer |
No |
The last port of the backend service port range of the endpoint group that is associated with the custom routing listener. The valid port range is 1 to 65499. The value of FromPort must be less than or equal to the value of ToPort. You can specify up to 20 end ports of backend service port ranges for each endpoint group of a custom routing listener. Note
This parameter is required only when Type is set to CustomRouting. |
80 |
| EndpointConfigurations |
array<object> |
No |
The configurations of the endpoint that is associated with the custom routing listener. You can specify up to 10 endpoints for each endpoint group of a custom routing listener. Note
This parameter is required only when Type is set to CustomRouting. |
|
|
array<object> |
No |
The configurations of the endpoint that is associated with the custom routing listener. You can specify up to 10 endpoints for each endpoint group of a custom routing listener. Note
This parameter is required only when Type is set to CustomRouting. |
||
| Type |
string |
No |
The type of the backend service. Set the value to PrivateSubNet. Note
This parameter is required only when Type is set to CustomRouting. |
PrivateSubNet |
| Endpoint |
string |
No |
The name of the vSwitch instance that is the endpoint of the custom routing listener. Note
This parameter is required only when Type is set to CustomRouting. |
vsw-test01 |
| TrafficToEndpointPolicy |
string |
No |
The traffic policy for the backend service. Valid values:
Note
This parameter is required only when Type is set to CustomRouting. |
DenyAll |
| PolicyConfigurations |
array<object> |
No |
The configurations of the traffic destination. You can specify up to 20 traffic destinations for each endpoint of a custom routing listener. Note
This parameter is required only when Type is set to CustomRouting. |
|
|
array<object> |
No |
The configurations of the traffic destination. You can specify up to 20 traffic destinations for each endpoint of a custom routing listener. Note
This parameter is required only when Type is set to CustomRouting. |
||
| Address |
string |
No |
The IP address of the traffic destination. This parameter is available only when TrafficToEndpointPolicy is set to AllowCustom. You can specify up to 20 destination IP addresses for each endpoint of a custom routing listener. Note
This parameter is required only when Type is set to CustomRouting. |
10.0.XX.XX |
| PortRanges |
array<object> |
No |
The port range of the traffic destination. The port range must be within the backend service port range of the endpoint group. If you do not specify this parameter, all ports are available. This parameter is available only when TrafficToEndpointPolicy is set to AllowCustom. You can specify up to 20 port ranges for each endpoint of a custom routing listener. You can specify up to five port ranges for each destination. Note
This parameter is required only when Type is set to CustomRouting. |
|
|
object |
No |
The port range of the traffic destination. The port range must be within the backend service port range of the endpoint group. If you do not specify this parameter, all ports are available. This parameter is available only when TrafficToEndpointPolicy is set to AllowCustom. You can specify up to 20 port ranges for each endpoint of a custom routing listener. You can specify up to five port ranges for each destination. Note
This parameter is required only when Type is set to CustomRouting. |
||
| FromPort |
integer |
No |
The first port of the destination port range. The port must be within the backend service port range of the endpoint group. This parameter is available only when TrafficToEndpointPolicy is set to AllowCustom. You can specify up to 20 port ranges for each endpoint of a custom routing listener. You can specify up to five start ports for each destination. Note
This parameter is required only when Type is set to CustomRouting. |
80 |
| ToPort |
integer |
No |
The last port of the destination port range. The port must be within the backend service port range of the endpoint group. This parameter is available only when TrafficToEndpointPolicy is set to AllowCustom. You can specify up to 20 port ranges for each endpoint of a custom routing listener. You can specify up to five end ports for each destination. Note
This parameter is required only when Type is set to CustomRouting. |
80 |
| IdleTimeout |
integer |
No |
The timeout period of idle connections. Unit: seconds.
|
900 |
| RequestTimeout |
integer |
No |
The timeout period for HTTP or HTTPS requests. Unit: seconds. Valid values: 1 to 180. Default value: 60. Note
This parameter is available only for HTTP and HTTPS listeners. If a backend server does not respond within the timeout period, GA returns an HTTP 504 error to the client. |
15 |
| HttpVersion |
string |
No |
The maximum version of the HTTP protocol. Valid values:
Note
This parameter is available only for HTTPS listeners. |
http2 |
Response elements
|
Element |
Type |
Description |
Example |
|
object |
The returned data. |
||
| RequestId |
string |
The ID of the request. |
04F0F334-1335-436C-A1D7-6C044FE73368 |
| ListenerId |
string |
The ID of the 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.