CreateListener
Creates a listener for an Alibaba Cloud Global Accelerator (GA) instance.
Operation description
Take note of the following items when you invoke this operation:
- CreateListener is an asynchronous operation. After you invoke this operation, the system returns a listener ID, but the listener is not immediately created. The creation task is still running in the background. You can invoke DescribeListener to query the status of the listener:
When the listener is in the init state, the listener is being created. In this state, you can only execute query operations and cannot execute other operations.
When the listener is in the active state, the listener is created.
You cannot invoke CreateListener to concurrently create listeners for the same Alibaba Cloud Global Accelerator (GA) instance.
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 Alibaba Cloud Global Accelerator (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. You can use the client to generate the value, but you must make sure that the value is unique among different requests. The client token can contain only ASCII characters. Note
If you do not set this parameter, the system automatically uses the RequestId of the API request as the ClientToken. The RequestId of each API request is unique. |
123e4567-e89b-12d3-a456-426655440000 |
| AcceleratorId |
string |
Yes |
The instance ID of the Alibaba Cloud Global Accelerator (GA). |
ga-bp1odcab8tmno0hdq**** |
| Name |
string |
No |
The name of the listener. The name must be 1 to 128 characters in length, and can contain digits, periods (.), underscores (_), and hyphens (-). It must start with a letter or a Chinese character. |
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 |
The client affinity.
|
SOURCE_IP |
| Protocol |
string |
No |
The network transmission protocol type of the listener. Valid values:
|
tcp |
| PortRanges |
array<object> |
Yes |
The listener port information. Valid values for the listener port: 1 to 65499. The maximum number of ports that you can configure depends on the listener routing type and protocol type. For more information, see Listener ports. |
|
|
object |
No |
The listener port information. Valid values for the listener port: 1 to 65499. The maximum number of ports that you can configure depends on the listener routing type and protocol type. For more information, see Listener ports. |
||
| FromPort |
integer |
Yes |
The start listener port that is used to accept and forward requests to endpoints. Valid values: 1 to 65499. The value of FromPort must be less than or equal to the value of ToPort. The maximum number of ports that you can configure depends on the listener routing type and protocol type. For more information, see Listener ports. Note
For HTTP or HTTPS listeners, you can configure only one listener port. This means that the start port and the end port must be the same. |
20 |
| ToPort |
integer |
Yes |
The end listener port that is used to accept and forward requests to endpoints. Valid values: 1 to 65499. The value of FromPort must be less than or equal to the value of ToPort. The maximum number of ports that you can configure depends on the listener routing type and protocol type. For more information, see Listener ports. Note
For HTTP or HTTPS listeners, you can configure only one listener port. This means that the start port and the end port must be the same. |
20 |
| Certificates |
array<object> |
No |
The list of SSL certificates. |
|
|
object |
No |
The list of 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 configuration of the XForward fields. |
|
| XForwardedForGaIdEnabled |
boolean |
No |
Specifies whether to use the GA-ID header field to retrieve the Alibaba Cloud Global Accelerator (GA) instance ID. Valid values:
Note
This parameter is supported only by HTTP and HTTPS listeners. |
false |
| XForwardedForGaApEnabled |
boolean |
No |
Specifies whether to use the GA-AP header field to retrieve the acceleration area information. Valid values:
Note
This parameter is supported only by HTTP and HTTPS listeners. |
false |
| XForwardedForProtoEnabled |
boolean |
No |
Specifies whether to use the GA-X-Forward-Proto header field to retrieve the listener protocol of the Alibaba Cloud Global Accelerator (GA) instance. Valid values:
Note
This parameter is supported only by HTTP and HTTPS listeners. |
false |
| XForwardedForPortEnabled |
boolean |
No |
Specifies whether to use the GA-X-Forward-Port header field to retrieve the listener port of the Alibaba Cloud Global Accelerator (GA) instance. Valid values:
Note
This parameter is supported only by HTTP and HTTPS listeners. |
false |
| XRealIpEnabled |
boolean |
No |
Specifies whether to use the X-Real-IP header field to retrieve the actual client IP address. Valid values:
Note
This parameter is supported only by HTTP and HTTPS listeners. |
false |
| SecurityPolicyId |
string |
No |
The instance ID of the security policy. Valid values:
Note
This parameter is supported only by 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 configuration information of the endpoint group for the intelligent routing listener. You can configure up to 10 endpoint groups of this type. Note
You can configure the endpoint group and endpoint information for an intelligent routing listener only when the value of Type (listener routing type) is Standard (intelligent routing). |
|
|
array<object> |
No |
The configuration of the endpoint group for the intelligent routing listener. You can configure up to 10 endpoint groups of this type. Note
You can configure the endpoint group and endpoint information for an intelligent routing listener only when the value of Type (listener routing type) is Standard (intelligent routing). |
||
| EndpointGroupName |
string |
No |
The name of the endpoint group for the intelligent routing listener. The name must be 1 to 128 characters in length, and can contain digits, periods (.), underscores (_), and hyphens (-). It must start with a letter or a Chinese character. You can enter up to 10 endpoint group names. Note
You can configure the endpoint group and endpoint information for an intelligent routing listener only when the value of Type (listener routing type) is Standard (intelligent routing). |
test |
| EndpointGroupDescription |
string |
No |
The description of the endpoint group for the intelligent routing listener. The description can be up to 200 characters in length, and cannot contain You can enter up to 10 endpoint group descriptions. Note
You can configure the endpoint group and endpoint information for an intelligent routing listener only when the value of Type (listener routing type) is Standard (intelligent routing). |
test |
| EndpointGroupRegion |
string |
No |
The region ID of the endpoint group for the intelligent routing listener. You can enter up to 10 region IDs for the endpoint group. Note
You can configure the endpoint group and endpoint information for an intelligent routing listener only when the value of Type (listener routing type) is Standard (intelligent routing). |
cn-hangzhou |
| TrafficPercentage |
integer |
No |
The traffic distribution ratio. When an intelligent routing listener has multiple endpoint groups, this parameter specifies the proportion of traffic distributed to different endpoint groups. Valid values: 1 to 100. Default value: 100. You can enter up to 10 traffic distribution ratios for the endpoint groups. Note
You can configure the endpoint group and endpoint information for an intelligent routing listener only when the value of Type (listener routing type) is Standard (intelligent routing). |
100 |
| HealthCheckEnabled |
boolean |
No |
Specifies whether to enable health checks for the endpoint group of the intelligent routing listener. Valid values:
You can enable health checks for up to 10 endpoint groups. Note
You can configure the endpoint group and endpoint information for an intelligent routing listener only when the value of Type (listener routing type) is Standard (intelligent routing). |
false |
| HealthCheckIntervalSeconds |
integer |
No |
The interval between two consecutive health checks. Unit: seconds. You can enter up to 10 health check intervals. Note
You can configure the endpoint group and endpoint information for an intelligent routing listener only when the value of Type (listener routing type) is Standard (intelligent routing). |
3 |
| HealthCheckPath |
string |
No |
The health check path. You can enter up to 10 health check paths. Note
You can configure the endpoint group and endpoint information for an intelligent routing listener only when the value of Type (listener routing type) is Standard (intelligent routing). |
/healthcheck |
| HealthCheckPort |
integer |
No |
The health check port. Valid values: 1 to 65535. You can enter up to 10 health check ports. Note
You can configure the endpoint group and endpoint information for an intelligent routing listener only when the value of Type (listener routing type) is Standard (intelligent routing). |
20 |
| HealthCheckProtocol |
string |
No |
The health check protocol. Valid values:
You can enter up to 10 health check protocols. Note
You can configure the endpoint group and endpoint information for an intelligent routing listener only when the value of Type (listener routing type) is Standard (intelligent routing). |
tcp |
| ThresholdCount |
integer |
No |
The number of consecutive health checks that are required to change the health check status. This refers to the number of consecutive failed health checks required to change the status from healthy to unhealthy, or the number of consecutive successful health checks required to change the status from unhealthy to healthy. Valid values: 2 to 10. Default value: 3. You can enter up to 10 threshold counts for health check status changes. Note
You can configure the endpoint group and endpoint information for an intelligent routing listener only when the value of Type (listener routing type) is Standard (intelligent routing). |
3 |
| EndpointConfigurations |
array<object> |
No |
The endpoint configuration information for the intelligent routing listener. |
|
|
object |
No |
The endpoint configuration information for the intelligent routing listener. |
||
| Type |
string |
No |
The endpoint type for the intelligent routing listener. Valid values:
You can enter up to 100 endpoint types in an endpoint group of an intelligent routing listener. Note
Note
For more information, see Service-linked roles. |
Ip |
| Weight |
integer |
No |
The weight of the endpoint for the intelligent routing listener. Valid values: 0 to 255. You can enter up to 100 endpoint weights in an endpoint group of an intelligent routing listener. Note
|
20 |
| Endpoint |
string |
No |
The IP address or domain name of the endpoint for the intelligent routing listener. You can enter up to 100 IP addresses or domain names of endpoints in an endpoint group of an intelligent routing listener. Note
This parameter is required when the value of Type (listener routing type) is Standard (intelligent routing). |
47.0.XX.XX |
| SubAddress |
string |
No |
The private IP of the elastic network interface controller (NIC). Note
This parameter is optional when the endpoint type is ENI. If you do not configure this parameter, the primary private IP of the ENI is used by default. |
172.168.XX.XX |
| EnableClientIPPreservation |
boolean |
No |
Specifies whether to enable client IP address preservation by using the automatic retrieval method. Valid values:
Note
|
|
| EnableProxyProtocol |
boolean |
No |
Specifies whether to enable client IP address preservation by using the Proxy Protocol method. Valid values:
Note
|
|
| VpcId |
string |
No |
The ID of the VPC. You can enter up to 1 VPC ID in an endpoint group of an intelligent routing listener. Note
This parameter is required and takes effect only when the endpoint type is IpTarget. |
vpc-bp13r1kpr2lel**** |
| VSwitchIds |
array |
No |
The list of vSwitches in the VPC. |
|
|
string |
No |
The ID of the vSwitch. You can enter up to 2 vSwitch IDs in an endpoint group of an intelligent routing listener. Note
This parameter is required and takes effect only when the endpoint type is IpTarget.
|
vsw-0jlhcznhw5m7pz2fa**** |
|
| Provider |
string |
No |
The provider of the endpoint configuration. |
BAILIAN |
| ApiKeys |
array |
No |
The API keys in the endpoint group configuration. |
|
|
string |
No |
The API keys in the endpoint group configuration. |
sk-****** |
|
| EndpointRequestProtocol |
string |
No |
Terms of Service protocol of the endpoint for the intelligent routing listener. Valid values:
You can enter up to 10 backend service protocols. Note
|
HTTP |
| EndpointProtocolVersion |
string |
No |
Terms of Service protocol version of the endpoint for the intelligent routing listener. Valid values:
Note
You can configure Terms of Service protocol version only when the value of EndpointRequestProtocol (backend service protocol) is HTTPS. |
HTTP1.1 |
| EndpointGroupType |
string |
No |
The endpoint group type for the intelligent routing listener. Valid values:
You can enter up to 10 endpoint group types. Note
|
default |
| PortOverrides |
array<object> |
No |
The port mapping relationships. |
|
|
object |
No |
The port mapping relationships. |
||
| ListenerPort |
integer |
No |
The listener port for port mapping. You can enter up to 5 listener ports for port mapping. Note
|
443 |
| EndpointPort |
integer |
No |
The endpoint port for port mapping. You can enter up to 5 endpoint ports for port mapping. Note
|
80 |
| HealthCheckHost |
string |
No |
The domain name for health checks. |
www.taobao.com |
| EndpointIpVersion |
string |
No |
The IP address protocol of the backend service. Valid values:
|
IPv4 |
| HealthCheckMethod |
string |
No |
The HTTP request method used for health checks. |
GET |
| HealthCheckSuccessCodes |
string |
No |
The set of HTTP status codes that indicate a successful health check. |
http_2xx,http_3xx |
| CustomRoutingEndpointGroupConfigurations |
array<object> |
No |
The endpoint group configurations for a custom route listener. You can configure up to five endpoint groups of this type. Note
You can configure endpoint groups and endpoints for a custom route listener only when Type is set to CustomRouting. |
|
|
array<object> |
No |
The endpoint group configurations for a custom route listener. You can configure up to five endpoint groups of this type. Note
You can configure endpoint groups and endpoints for a custom route listener only when Type is set to CustomRouting. |
||
| EndpointGroupRegion |
string |
No |
The region ID of the endpoint group for a custom route listener. You can specify up to five region IDs for endpoint groups. Note
You can configure endpoint groups and endpoints for a custom route listener only when Type is set to CustomRouting. |
cn-hangzhou |
| Name |
string |
No |
The name of the endpoint group for a custom route listener. The name must be 1 to 128 characters in length, and can contain digits, periods (.), underscores (_), and hyphens (-). It must start with a letter or a Chinese character. You can specify up to five endpoint group names. Note
You can configure endpoint groups and endpoints for a custom route listener only when Type is set to CustomRouting. |
test |
| Description |
string |
No |
The description of the endpoint group for a custom route listener. The description can be up to 200 characters in length and cannot contain You can specify descriptions for up to five endpoint groups. Note
You can configure endpoint groups and endpoints for a custom route listener only when Type is set to CustomRouting. |
test |
| DestinationConfigurations |
array<object> |
No |
The mapping configurations of the endpoint group for a custom route listener. You must specify the service port range and protocol type of the backend service in the endpoint group. The specified information is mapped to the service port range of the associated listener. You can specify up to 20 port range and protocol mappings for each endpoint group of a custom route listener. Note
You can configure endpoint groups and endpoints for a custom route listener only when Type is set to CustomRouting. |
|
|
object |
No |
The mapping configurations of the endpoint group for a custom route listener. You must specify the service port range and protocol type of the backend service in the endpoint group. The specified information is mapped to the service port range of the associated listener. You can specify up to 20 port range and protocol mappings for each endpoint group of a custom route listener. Note
You can configure endpoint groups and endpoints for a custom route listener only when Type is set to CustomRouting. |
||
| Protocols |
array |
No |
The protocol type of the backend Terms of Service in the endpoint group for a custom route listener. You can specify up to four backend Terms of Service protocol types in the port range and protocol mappings for each endpoint group of a custom route listener. Note
You can configure endpoint groups and endpoints for a custom route listener only when Type is set to CustomRouting. |
|
|
string |
No |
The protocol type of the backend Terms of Service in the endpoint group for a custom route listener. Valid values:
You can specify up to four backend Terms of Service protocol types in the port range and protocol mappings for each endpoint group of a custom route listener. Note
You can configure endpoint groups and endpoints for a custom route listener only when Type is set to CustomRouting. |
TCP |
|
| FromPort |
integer |
No |
The start port of the backend service in the endpoint group for a custom route listener. Valid values: 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 the backend service for each endpoint group of a custom route listener. Note
You can configure endpoint groups and endpoints for a custom route listener only when Type is set to CustomRouting. |
80 |
| ToPort |
integer |
No |
The end port of the backend service in the endpoint group for a custom route listener. Valid values: 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 the backend service for each endpoint group of a custom route listener. Note
You can configure endpoint groups and endpoints for a custom route listener only when Type is set to CustomRouting. |
80 |
| EndpointConfigurations |
array<object> |
No |
The endpoint configurations for a custom route listener. You can specify up to 10 endpoints for each endpoint group of a custom route listener. Note
You can configure endpoint groups and endpoints for a custom route listener only when Type is set to CustomRouting. |
|
|
array<object> |
No |
The endpoint configurations for a custom route listener. You can specify up to 10 endpoints for each endpoint group of a custom route listener. Note
You can configure endpoint groups and endpoints for a custom route listener only when Type is set to CustomRouting. |
||
| Type |
string |
No |
The backend service type of the endpoint for a custom route listener. Valid values:
Note
You can configure endpoint groups and endpoints for a custom route listener only when Type is set to CustomRouting. |
PrivateSubNet |
| Endpoint |
string |
No |
The name of the vSwitch instance for the endpoint of a custom route listener. Note
You can configure endpoint groups and endpoints for a custom route listener only when Type is set to CustomRouting. |
vsw-test01 |
| TrafficToEndpointPolicy |
string |
No |
The traffic access policy for the backend service of the endpoint for a custom route listener. Valid values:
Note
You can configure endpoint groups and endpoints for a custom route listener only when Type is set to CustomRouting. |
DenyAll |
| PolicyConfigurations |
array<object> |
No |
The traffic destination configurations for the endpoint of a custom route listener. You can specify up to 20 traffic destinations for each endpoint of a custom route listener. Note
You can configure endpoint groups and endpoints for a custom route listener only when Type is set to CustomRouting. |
|
|
array<object> |
No |
The traffic destination configurations for the endpoint of a custom route listener. You can specify up to 20 traffic destinations for each endpoint of a custom route listener. Note
You can configure endpoint groups and endpoints for a custom route listener only when Type is set to CustomRouting. |
||
| Address |
string |
No |
The IP address of the destination that can accept access traffic. This parameter takes effect only when TrafficToEndpointPolicy is set to AllowCustom. You can specify up to 20 destination IP addresses for each endpoint of a custom route listener. Note
You can configure endpoint groups and endpoints for a custom route listener only when Type is set to CustomRouting. |
10.0.XX.XX |
| PortRanges |
array<object> |
No |
The service port range of the destination that can accept access traffic. The service port range must fall within the service port range of the backend service in the endpoint group. If this parameter is left empty, all ports of the destination are supported. This parameter takes effect only when TrafficToEndpointPolicy is set to AllowCustom. You can specify port ranges for up to 20 destinations for each endpoint of a custom route listener. You can specify up to five port ranges for each destination. Note
You can configure endpoint groups and endpoints for a custom route listener only when Type is set to CustomRouting. |
|
|
object |
No |
The service port range of the destination that can accept access traffic. The service port range must fall within the service port range of the backend service in the endpoint group. If this parameter is left empty, all ports of the destination are supported. This parameter takes effect only when TrafficToEndpointPolicy is set to AllowCustom. You can specify port ranges for up to 20 destinations for each endpoint of a custom route listener. You can specify up to five port ranges for each destination. Note
You can configure endpoint groups and endpoints for a custom route listener only when Type is set to CustomRouting. |
||
| FromPort |
integer |
No |
The start port of the destination that can accept access traffic. The port must fall within the backend service port range of the endpoint group. This parameter takes effect only when TrafficToEndpointPolicy is set to AllowCustom. You can specify port ranges for up to 20 destinations for each endpoint of a custom route listener. You can specify up to five start ports for each destination. Note
You can configure endpoint groups and endpoints for a custom route listener only when Type is set to CustomRouting. |
80 |
| ToPort |
integer |
No |
The end port of the destination that can accept access traffic. The port must fall within the backend service port range of the endpoint group. This parameter takes effect only when TrafficToEndpointPolicy is set to AllowCustom. You can specify port ranges for up to 20 destinations for each endpoint of a custom route listener. You can specify up to five end ports for each destination. Note
You can configure endpoint groups and endpoints for a custom route listener only when Type is set to CustomRouting. |
80 |
| IdleTimeout |
integer |
No |
The idle connection timeout period. Unit: seconds.
|
900 |
| RequestTimeout |
integer |
No |
The request timeout period for HTTP or HTTPS connections. Unit: seconds. Valid values: 1 to 180. Default value: 60. Note
This parameter takes effect only for listeners whose protocol type is HTTP or HTTPS. If the backend server does not return a response within the timeout period, Global Accelerator stops waiting and returns an HTTP 504 error code to the client. |
15 |
| HttpVersion |
string |
No |
The maximum version of the HTTP protocol. Valid values:
Note
This parameter is supported only by HTTPS listeners. |
http2 |
Response elements
|
Element |
Type |
Description |
Example |
|
object |
The response information. |
||
| RequestId |
string |
The request ID. |
04F0F334-1335-436C-A1D7-6C044FE73368 |
| ListenerId |
string |
The listener ID. |
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.