CreateListener
Creates a listener.
Operation description
The CreateListener operation is asynchronous. The system returns a request ID, but the HTTP, HTTPS, or QUIC listener is not yet created. The creation task is still running in the background. You can call the GetListenerAttribute operation to query the creation status of the HTTP, HTTPS, or QUIC listener:
If the HTTP, HTTPS, or QUIC listener is in the Provisioning state, the listener is being created.
If the HTTP, HTTPS, or QUIC listener is in the Running state, the listener is created.
Try it now
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
alb:CreateListener |
create |
*LoadBalancer
*SecurityPolicy
*ServerGroup
|
|
None |
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| LoadBalancerId |
string |
Yes |
The instance ID of the application load balancing instance. |
alb-n5qw04uq8vavfe**** |
| ClientToken |
string |
No |
The client token that is used to ensure the idempotence of the request. You can generate the parameter value from your client to ensure that the value is unique across different requests. The ClientToken parameter supports only ASCII characters. Note
If you do not specify 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 |
| DryRun |
boolean |
No |
Specifies whether to perform a dry run. Valid values:
|
false |
| ListenerProtocol |
string |
Yes |
The listener protocol. Valid values: HTTP, HTTPS, and QUIC. |
HTTP |
| ListenerPort |
integer |
Yes |
The frontend port used by the load balancing instance. Valid values: 1 to 65535. |
80 |
| ListenerDescription |
string |
No |
The custom name of the listener. The name must be 2 to 256 characters in length, and can contain letters, digits, Chinese characters, hyphens (-), forward slashes (/), periods (.), and underscores (_). |
HTTP_80 |
| RequestTimeout |
integer |
No |
The request timeout period. Unit: seconds. Valid values: 1 to 600. Default value: 60. If there is no response from the backend server within the timeout period, load balancing stops waiting and returns an Note
You can apply to increase the quota to extend the maximum request timeout period to 3,600 seconds. |
60 |
| IdleTimeout |
integer |
No |
The idle connection timeout period. Unit: seconds. Valid values: 1 to 600. Default value: 15. If there is no access request within the timeout period, load balancing temporarily breaks the current connection and establishes a new connection when the next request arrives. Note
You can apply to increase the quota to extend the maximum idle connection timeout period to 3,600 seconds. |
3 |
| GzipEnabled |
boolean |
No |
Specifies whether to enable
|
true |
| Http2Enabled |
boolean |
No |
Specifies whether to enable
Note
This parameter is supported only by HTTPS listeners. |
true |
| SecurityPolicyId |
string |
No |
The ID of the security policy. System security policies and custom security policies are supported. Default value: tls_cipher_policy_1_0 (system security policy). Note
This parameter is supported only by HTTPS listeners. |
tls_cipher_policy_1_0 |
| CaEnabled |
boolean |
No |
Specifies whether to enable mutual authentication. Valid values:
|
false |
| XForwardedForConfig |
object |
No |
The X-Forwarded-For configuration. |
|
| XForwardedForClientCertClientVerifyAlias |
string |
No |
The custom header name. This parameter takes effect only when XForwardedForClientCertClientVerifyEnabled is set to true. The name must be 1 to 40 characters in length, and can contain lowercase letters, hyphens (-), underscores (_), and digits. Note
This parameter is supported only by HTTPS listeners. |
test_client-verify-alias_123456 |
| XForwardedForClientCertClientVerifyEnabled |
boolean |
No |
Specifies whether to use the
Note
This parameter is supported only by HTTPS listeners. |
true |
| XForwardedForClientCertFingerprintAlias |
string |
No |
The custom header name. This parameter takes effect only when XForwardedForClientCertFingerprintEnabled is set to true. The name must be 1 to 40 characters in length, and can contain lowercase letters, hyphens (-), underscores (_), and digits. Note
This parameter is supported only by HTTPS listeners. |
test_finger-print-alias_123456 |
| XForwardedForClientCertFingerprintEnabled |
boolean |
No |
Specifies whether to use the
Note
This parameter is supported only by HTTPS listeners. |
true |
| XForwardedForClientCertIssuerDNAlias |
string |
No |
The custom header name. This parameter takes effect only when XForwardedForClientCertIssuerDNEnabled is set to true. The name must be 1 to 40 characters in length, and can contain lowercase letters, hyphens (-), underscores (_), and digits. Note
This parameter is supported only by HTTPS listeners. |
test_issue-dn-alias_123456 |
| XForwardedForClientCertIssuerDNEnabled |
boolean |
No |
Specifies whether to use the
Note
This parameter is supported only by HTTPS listeners. |
true |
| XForwardedForClientCertSubjectDNAlias |
string |
No |
The custom header name. This parameter takes effect only when XForwardedForClientCertSubjectDNEnabled is set to true. The name must be 1 to 40 characters in length, and can contain lowercase letters, hyphens (-), underscores (_), and digits. Note
This parameter is supported only by HTTPS listeners. |
test_subject-dn-alias_123456 |
| XForwardedForClientCertSubjectDNEnabled |
boolean |
No |
Specifies whether to use the
Note
This parameter is supported only by HTTPS listeners. |
true |
| XForwardedForClientSrcPortEnabled |
boolean |
No |
Specifies whether to use the
Note
This parameter is supported by HTTP and HTTPS listeners. |
true |
| XForwardedForEnabled |
boolean |
No |
Specifies whether to use the
Note
|
true |
| XForwardedForProcessingMode |
string |
No |
The processing mode of the
Note
|
append |
| XForwardedForProtoEnabled |
boolean |
No |
Specifies whether to use the
Note
This parameter is supported by HTTP, HTTPS, and QUIC listeners. |
false |
| XForwardedForSLBIdEnabled |
boolean |
No |
Specifies whether to use the
Note
This parameter is supported by HTTP, HTTPS, and QUIC listeners. |
false |
| XForwardedForSLBPortEnabled |
boolean |
No |
Specifies whether to use the
Note
This parameter is supported by HTTP, HTTPS, and QUIC listeners. |
false |
| XForwardedForClientSourceIpsEnabled |
boolean |
No |
Specifies whether to allow ALB to obtain the real IP address of the client from the X-Forwarded-For header. Valid values:
Note
This parameter is supported by HTTP and HTTPS listeners. |
false |
| XForwardedForClientSourceIpsTrusted |
string |
No |
The trusted proxy IP addresses. Application Load Balancing (ALB) traverses the |
10.1.1.0/24 |
| XForwardedForHostEnabled |
boolean |
No |
Specifies whether to use the
Note
This parameter is supported by HTTP, HTTPS, and QUIC listeners. |
false |
| QuicConfig |
object |
No |
The configuration of the associated QUIC listener. |
|
| QuicListenerId |
string |
No |
The ID of the QUIC listener to be associated. This parameter is valid for HTTPS listeners and is required when QuicUpgradeEnabled is set to true. Note
The original listener and the associated QUIC listener must belong to the same ALB instance, and the QUIC listener must not have been associated before. |
lsn-o4u54y73wq7b****** |
| QuicUpgradeEnabled |
boolean |
No |
Specifies whether to enable QUIC upgrade. Valid values:
Note
This parameter is supported only by HTTPS listeners. |
false |
| Certificates |
array<object> |
No |
The certificate list. |
|
|
object |
No |
The certificate structure. |
||
| CertificateId |
string |
No |
The ID of the default certificate. You can add only one default server certificate. Note
|
103705******* |
| CaCertificates |
array<object> |
No |
The list of CA certificates configured for the listener. You can add only one CA certificate. |
|
|
object |
No |
The CA certificate structure. |
||
| CertificateId |
string |
No |
The ID of the CA certificate. Note
This parameter is required when the CaEnabled parameter is set to true. |
123157******* |
| DefaultActions |
array<object> |
Yes |
The list of rule actions. |
|
|
array<object> |
Yes |
The list of rule actions. |
||
| ForwardGroupConfig |
object |
Yes |
The configuration for the forward action. You can add up to 20 forward action configurations. |
|
| ServerGroupTuples |
array<object> |
Yes |
The destination server group tuples for forwarding. |
|
|
object |
Yes |
The destination server group tuples for forwarding. |
||
| ServerGroupId |
string |
Yes |
The ID of the destination server group to which requests are forwarded. |
sgp-8ilqs4axp6****** |
| Type |
string |
Yes |
The action type. You can add only one action type. Valid values: ForwardGroup: forwards requests to multiple server groups. |
ForwardGroup |
| Tag |
array<object> |
No |
The tags. |
|
|
object |
No |
The tag structure. |
||
| Key |
string |
No |
The tag key. The key can be up to 128 characters in length. It cannot start with aliyun or acs:, and cannot contain http:// or https://. |
env |
| Value |
string |
No |
The tag value. The value can be up to 128 characters in length. It cannot start with aliyun or acs:, and cannot contain http:// or https://. |
product |
Response elements
|
Element |
Type |
Description |
Example |
|
object |
The listener creation response. |
||
| JobId |
string |
The ID of the asynchronous task. |
72dcd26b-f12d-4c27-b3af-18f6aed5**** |
| ListenerId |
string |
The ID of the listener. |
lsn-o4u54y73wq7b****** |
| RequestId |
string |
The ID of the request. |
CEF72CEB-54B6-4AE8-B225-F876******* |
Examples
Success response
JSON format
{
"JobId": "72dcd26b-f12d-4c27-b3af-18f6aed5****",
"ListenerId": "lsn-o4u54y73wq7b******",
"RequestId": "CEF72CEB-54B6-4AE8-B225-F876*******"
}
Error codes
|
HTTP status code |
Error code |
Error message |
Description |
|---|---|---|---|
| 400 | ResourceAlreadyExist.Listener | The specified resource %s is already exist. | A listener with the same port already exists. |
| 400 | IncorrectStatus.LoadBalancer | The status of %s [%s] is incorrect. | The current status of the instance does not support this operation. |
| 400 | IncorrectBusinessStatus.LoadBalancer | The business status of %s [%s] is incorrect. | |
| 400 | ResourceQuotaExceeded.LoadBalancerListenersNum | The quota of %s is exceeded for resource %s, usage %s/%s. | The quota of %s is exceeded for resource %s, usage %s/%s. |
| 400 | OperationDenied.CrossLoadBalancerQUICListener | The operation is not allowed because of %s. | The operation is not allowed because of %s. |
| 400 | ResourceAlreadyAssociated.Listener | The specified resource %s is already associated. | The specified resource %s is already associated. |
| 400 | ResourceQuotaExceeded.SecurityPolicyAttachedNum | The quota of %s is exceeded for resource %s, usage %s/%s. | The quota of %s is exceeded for resource %s. Usage: %s/%s. |
| 400 | ResourceQuotaExceeded.ServerGroupAttachedNum | The quota of %s is exceeded for resource %s, usage %s/%s. | The number of associations allowed for the server group exceeds the quota limit. |
| 400 | ResourceQuotaExceeded.LoadBalancerServersNum | The quota of %s is exceeded for resource %s, usage %s/%s. | The number of backend servers has exceeded the quota limit. |
| 400 | ResourceQuotaExceeded.ServerAddedNum | The quota of %s is exceeded for resource %s, usage %s/%s. | The number of servers added to the server group exceeds the quota limit. |
| 400 | Mismatch.VpcId | The %s is mismatched for %s and %s. | The %s is mismatched for %s and %s. |
| 400 | OperationDenied.ServerGroupProtocolNotSupport | The operation is not allowed because of ServerGroupProtocolNotSupport. | The operation is not allowed because the server group protocol is not supported. |
| 400 | OperationDenied.GRPCServerGroup | The operation is not allowed because of %s. | The operation is denied because a listener bound to this gRPC server group does not have HTTP/2.0 enabled. |
| 400 | Mismatch.LoadBalancerEditionAndConnectionDrain | The %s and %s are mismatched. | The %s and %s are mismatched. |
| 400 | Mismatch.LoadBalancerEditionAndSlowStartEnable | The %s and %s are mismatched. | The %s and %s are mismatched. |
| 400 | InvalidParameter | Invalid parameter, please check the parameter input. | At least one parameter is invalid. Check your input. |
| 400 | OperationDenied.CACertificateCorrupted | The CA certificate is corrupted. | CA certificate is corrupted |
| 403 | Forbidden.SecurityPolicy | Authentication has failed for SecurityPolicy. | Authentication failed for the SecurityPolicy. |
| 403 | Forbidden.LoadBalancer | Authentication is failed for %s. | Authentication is failed for %s. |
| 403 | Forbidden.Listener | Authentication is failed for %s. | Authentication is failed for %s. |
| 404 | ResourceNotFound.LoadBalancer | The specified resource %s is not found. | The specified resource %s is not found. |
| 404 | ResourceNotFound.ServerGroup | The specified resource %s is not found. | The backend server group does not exist. |
| 404 | ResourceNotFound.SecurityPolicy | The specified resource %s is not found. | The specified resource %s is not found. |
| 404 | ResourceNotFound.Listener | The specified resource %s is not found. | The listener does not exist. |
| 404 | ResourceNotFound.Certificate | The specified resource %s is not found. | The specified resource %s is not found. |
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.