modify-listener
Description
Replaces the specified properties of the specified listener. Any properties that you do not specify remain unchanged.
Changing the protocol from HTTPS to HTTP, or from TLS to TCP, removes the security policy and default certificate properties. If you change the protocol from HTTP to HTTPS, or from TCP to TLS, you must add the security policy and default certificate properties.
To add an item to a list, remove an item from a list, or update an item in a list, you must provide the entire list. For example, to add an action, specify a list with the current actions plus the new action.
See also: AWS API Documentation
Synopsis
modify-listener
--listener-arn <value>
[--port <value>]
[--protocol <value>]
[--ssl-policy <value>]
[--certificates <value>]
[--default-actions <value>]
[--alpn-policy <value>]
[--mutual-authentication <value>]
[--cli-input-json | --cli-input-yaml]
[--generate-cli-skeleton <value>]
[--debug]
[--endpoint-url <value>]
[--no-verify-ssl]
[--no-paginate]
[--output <value>]
[--query <value>]
[--profile <value>]
[--region <value>]
[--version <value>]
[--color <value>]
[--no-sign-request]
[--ca-bundle <value>]
[--cli-read-timeout <value>]
[--cli-connect-timeout <value>]
[--cli-binary-format <value>]
[--no-cli-pager]
[--cli-auto-prompt]
[--no-cli-auto-prompt]
Options
--listener-arn (string)
--port (integer)
--protocol (string)
The protocol for connections from clients to the load balancer. Application Load Balancers support the HTTP and HTTPS protocols. Network Load Balancers support the TCP, TLS, UDP, and TCP_UDP protocols. You can’t change the protocol to UDP or TCP_UDP if dual-stack mode is enabled. You can’t specify a protocol for a Gateway Load Balancer.
Possible values:
HTTPHTTPSTCPTLSUDPTCP_UDPGENEVE
--ssl-policy (string)
[HTTPS and TLS listeners] The security policy that defines which protocols and ciphers are supported.
For more information, see Security policies in the Application Load Balancers Guide or Security policies in the Network Load Balancers Guide .
--certificates (list)
[HTTPS and TLS listeners] The default certificate for the listener. You must provide exactly one certificate. Set CertificateArn to the certificate ARN but do not set IsDefault .
(structure)
Information about an SSL server certificate.
CertificateArn -> (string)
IsDefault -> (boolean)
Shorthand Syntax:
CertificateArn=string,IsDefault=boolean ...
JSON Syntax:
[
{
"CertificateArn": "string",
"IsDefault": true|false
}
...
]
--default-actions (list)
The actions for the default rule.
(structure)
Information about an action.
Each rule must include exactly one of the following types of actions: forward , fixed-response , or redirect , and it must be the last action to be performed.
Type -> (string)
TargetGroupArn -> (string)
Type is forward and you want to route to a single target group. To route to one or more target groups, use ForwardConfig instead.AuthenticateOidcConfig -> (structure)
[HTTPS listeners] Information about an identity provider that is compliant with OpenID Connect (OIDC). Specify only when Type is authenticate-oidc .
Issuer -> (string)
AuthorizationEndpoint -> (string)
TokenEndpoint -> (string)
UserInfoEndpoint -> (string)
ClientId -> (string)
ClientSecret -> (string)
UseExistingClientSecret to true.SessionCookieName -> (string)
Scope -> (string)
The set of user claims to be requested from the IdP. The default is openid .
To verify which scope values your IdP supports and how to separate multiple values, see the documentation for your IdP.
SessionTimeout -> (long)
AuthenticationRequestExtraParams -> (map)
The query parameters (up to 10) to include in the redirect request to the authorization endpoint.
key -> (string)
value -> (string)
OnUnauthenticatedRequest -> (string)
The behavior if the user is not authenticated. The following are possible values:
- deny- Return an HTTP 401 Unauthorized error.
- allow- Allow the request to be forwarded to the target.
- authenticate- Redirect the request to the IdP authorization endpoint. This is the default value.
UseExistingClientSecret -> (boolean)
AuthenticateCognitoConfig -> (structure)
[HTTPS listeners] Information for using Amazon Cognito to authenticate users. Specify only when Type is authenticate-cognito .
UserPoolArn -> (string)
UserPoolClientId -> (string)
UserPoolDomain -> (string)
SessionCookieName -> (string)
Scope -> (string)
The set of user claims to be requested from the IdP. The default is openid .
To verify which scope values your IdP supports and how to separate multiple values, see the documentation for your IdP.
SessionTimeout -> (long)
AuthenticationRequestExtraParams -> (map)
The query parameters (up to 10) to include in the redirect request to the authorization endpoint.
key -> (string)
value -> (string)
OnUnauthenticatedRequest -> (string)
The behavior if the user is not authenticated. The following are possible values:
- deny- Return an HTTP 401 Unauthorized error.
- allow- Allow the request to be forwarded to the target.
- authenticate- Redirect the request to the IdP authorization endpoint. This is the default value.
Order -> (integer)
RedirectConfig -> (structure)
[Application Load Balancer] Information for creating a redirect action. Specify only when Type is redirect .
Protocol -> (string)
Port -> (string)
Host -> (string)
Path -> (string)
Query -> (string)
StatusCode -> (string)
FixedResponseConfig -> (structure)
[Application Load Balancer] Information for creating an action that returns a custom HTTP response. Specify only when Type is fixed-response .
MessageBody -> (string)
StatusCode -> (string)
ContentType -> (string)
The content type.
Valid Values: text/plain | text/css | text/html | application/javascript | application/json
ForwardConfig -> (structure)
Information for creating an action that distributes requests among one or more target groups. For Network Load Balancers, you can specify a single target group. Specify only when Type is forward . If you specify both ForwardConfig and TargetGroupArn , you can specify only one target group using ForwardConfig and it must be the same target group specified in TargetGroupArn .
TargetGroups -> (list)
The target groups. For Network Load Balancers, you can specify a single target group.
(structure)
Information about how traffic will be distributed between multiple target groups in a forward rule.
TargetGroupArn -> (string)
Weight -> (integer)
TargetGroupStickinessConfig -> (structure)
The target group stickiness for the rule.
Enabled -> (boolean)
DurationSeconds -> (integer)
JSON Syntax:
[
{
"Type": "forward"|"authenticate-oidc"|"authenticate-cognito"|"redirect"|"fixed-response",
"TargetGroupArn": "string",
"AuthenticateOidcConfig": {
"Issuer": "string",
"AuthorizationEndpoint": "string",
"TokenEndpoint": "string",
"UserInfoEndpoint": "string",
"ClientId": "string",
"ClientSecret": "string",
"SessionCookieName": "string",
"Scope": "string",
"SessionTimeout": long,
"AuthenticationRequestExtraParams": {"string": "string"
...},
"OnUnauthenticatedRequest": "deny"|"allow"|"authenticate",
"UseExistingClientSecret": true|false
},
"AuthenticateCognitoConfig": {
"UserPoolArn": "string",
"UserPoolClientId": "string",
"UserPoolDomain": "string",
"SessionCookieName": "string",
"Scope": "string",
"SessionTimeout": long,
"AuthenticationRequestExtraParams": {"string": "string"
...},
"OnUnauthenticatedRequest": "deny"|"allow"|"authenticate"
},
"Order": integer,
"RedirectConfig": {
"Protocol": "string",
"Port": "string",
"Host": "string",
"Path": "string",
"Query": "string",
"StatusCode": "HTTP_301"|"HTTP_302"
},
"FixedResponseConfig": {
"MessageBody": "string",
"StatusCode": "string",
"ContentType": "string"
},
"ForwardConfig": {
"TargetGroups": [
{
"TargetGroupArn": "string",
"Weight": integer
}
...
],
"TargetGroupStickinessConfig": {
"Enabled": true|false,
"DurationSeconds": integer
}
}
}
...
]
--alpn-policy (list)
[TLS listeners] The name of the Application-Layer Protocol Negotiation (ALPN) policy. You can specify one policy name. The following are the possible values:
HTTP1OnlyHTTP2OnlyHTTP2OptionalHTTP2PreferredNone
For more information, see ALPN policies in the Network Load Balancers Guide .
(string)
Syntax:
"string" "string" ...
--mutual-authentication (structure)
The mutual authentication configuration information.
Mode -> (string)
off , passthrough or verify . The default value is off .TrustStoreArn -> (string)
IgnoreClientCertificateExpiry -> (boolean)
TrustStoreAssociationStatus -> (string)
AdvertiseTrustStoreCaNames -> (string)
Shorthand Syntax:
Mode=string,TrustStoreArn=string,IgnoreClientCertificateExpiry=boolean,TrustStoreAssociationStatus=string,AdvertiseTrustStoreCaNames=string
JSON Syntax:
{
"Mode": "string",
"TrustStoreArn": "string",
"IgnoreClientCertificateExpiry": true|false,
"TrustStoreAssociationStatus": "active"|"removed",
"AdvertiseTrustStoreCaNames": "on"|"off"
}
--cli-input-json | --cli-input-yaml (string) Reads arguments from the JSON string provided. The JSON string follows the format provided by --generate-cli-skeleton. If other arguments are provided on the command line, those values will override the JSON-provided values. It is not possible to pass arbitrary binary values using a JSON-provided value as the string will be taken literally. This may not be specified along with --cli-input-yaml.
--generate-cli-skeleton (string) Prints a JSON skeleton to standard output without sending an API request. If provided with no value or the value input, prints a sample input JSON that can be used as an argument for --cli-input-json. Similarly, if provided yaml-input it will print a sample input YAML that can be used with --cli-input-yaml. If provided with the value output, it validates the command inputs and returns a sample output JSON for that command. The generated JSON skeleton is not stable between versions of the AWS CLI and there are no backwards compatibility guarantees in the JSON skeleton generated.
Global Options
--debug (boolean)
Turn on debug logging.
--endpoint-url (string)
Override command’s default URL with the given URL.
--no-verify-ssl (boolean)
By default, the AWS CLI uses SSL when communicating with AWS services. For each SSL connection, the AWS CLI will verify SSL certificates. This option overrides the default behavior of verifying SSL certificates.
--no-paginate (boolean)
Disable automatic pagination. If automatic pagination is disabled, the AWS CLI will only make one call, for the first page of results.
--output (string)
The formatting style for command output.
- json
- text
- table
- yaml
- yaml-stream
--query (string)
A JMESPath query to use in filtering the response data.
--profile (string)
Use a specific profile from your credential file.
--region (string)
The region to use. Overrides config/env settings.
--version (string)
Display the version of this tool.
--color (string)
Turn on/off color output.
- on
- off
- auto
--no-sign-request (boolean)
Do not sign requests. Credentials will not be loaded if this argument is provided.
--ca-bundle (string)
The CA certificate bundle to use when verifying SSL certificates. Overrides config/env settings.
--cli-read-timeout (int)
The maximum socket read time in seconds. If the value is set to 0, the socket read will be blocking and not timeout. The default value is 60 seconds.
--cli-connect-timeout (int)
The maximum socket connect time in seconds. If the value is set to 0, the socket connect will be blocking and not timeout. The default value is 60 seconds.
--cli-binary-format (string)
The formatting style to be used for binary blobs. The default format is base64. The base64 format expects binary blobs to be provided as a base64 encoded string. The raw-in-base64-out format preserves compatibility with AWS CLI V1 behavior and binary values must be passed literally. When providing contents from a file that map to a binary blob fileb:// will always be treated as binary and use the file contents directly regardless of the cli-binary-format setting. When using file:// the file contents will need to properly formatted for the configured cli-binary-format.
- base64
- raw-in-base64-out
--no-cli-pager (boolean)
Disable cli pager for output.
--cli-auto-prompt (boolean)
Automatically prompt for CLI input parameters.
--no-cli-auto-prompt (boolean)
Disable automatically prompt for CLI input parameters.
Examples
Note
To use the following examples, you must have the AWS CLI installed and configured. See the Getting started guide in the AWS CLI User Guide for more information.
Unless otherwise stated, all examples have unix-like quotation rules. These examples will need to be adapted to your terminal’s quoting rules. See Using quotation marks with strings in the AWS CLI User Guide .
Example 1: To change the default action to a forward action
The following modify-listener example changes the default action to a forward action for the specified listener.
aws elbv2 modify-listener \
--listener-arn arn:aws:elasticloadbalancing:us-west-2:123456789012:listener/app/my-load-balancer/50dc6c495c0c9188/f2f7dc8efc522ab2 \
--default-actions Type=forward,TargetGroupArn=arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/my-new-targets/2453ed029918f21f
Output:
{
"Listeners": [
{
"ListenerArn": "arn:aws:elasticloadbalancing:us-west-2:123456789012:listener/app/my-load-balancer/50dc6c495c0c9188/f2f7dc8efc522ab2",
"LoadBalancerArn": "arn:aws:elasticloadbalancing:us-west-2:123456789012:loadbalancer/app/my-load-balancer/50dc6c495c0c9188",
"Protocol": "HTTP",
"Port": 80,
"DefaultActions": [
{
"Type": "forward",
"TargetGroupArn": "arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/my-new-targets/2453ed029918f21f"
}
]
}
]
}
Example 2: To change the default action to a redirect action
The following modify-listener example changes the default action to a redirect action for the specified listener.
aws elbv2 modify-listener \
--listener-arn arn:aws:elasticloadbalancing:us-west-2:123456789012:listener/app/my-load-balancer/50dc6c495c0c9188/f2f7dc8efc522ab2 \
--default-actions Type=redirect, RedirectConfig='{Protocol=HTTPS,StatusCode=HTTP_302}'
Output:
{
"Listeners": [
{
"ListenerArn": "arn:aws:elasticloadbalancing:us-west-2:123456789012:listener/app/my-load-balancer/50dc6c495c0c9188/f2f7dc8efc522ab2",
"LoadBalancerArn": "arn:aws:elasticloadbalancing:us-west-2:123456789012:loadbalancer/app/my-load-balancer/50dc6c495c0c9188",
"Protocol": "HTTP",
"Port": 80,
"DefaultActions": [
{
"Type": "redirect",
"RedirectConfig": {
"Protocol": "HTTPS",
"Port": "#{port}",
"Host": "#{host}",
"Path": "/#{path}",
"Query": "#{query}",
"StatusCode": "HTTP_302",
}
}
]
}
]
}
Example 3: To change the server certificate
The following modify-listener example changes the server certificate for the specified HTTPS listener.
aws elbv2 modify-listener \
--listener-arn arn:aws:elasticloadbalancing:us-west-2:123456789012:listener/app/my-load-balancer/50dc6c495c0c9188/0467ef3c8400ae65 \
--certificates CertificateArn=arn:aws:iam::123456789012:server-certificate/my-new-server-cert
Output:
{
"Listeners": [
{
"ListenerArn": "arn:aws:elasticloadbalancing:us-west-2:123456789012:listener/app/my-load-balancer/50dc6c495c0c9188/0467ef3c8400ae65",
"LoadBalancerArn": "arn:aws:elasticloadbalancing:us-west-2:123456789012:loadbalancer/app/my-load-balancer/50dc6c495c0c9188",
"Protocol": "HTTPS",
"Port": 443,
"DefaultActions": [
{
"Type": "forward",
"TargetGroupArn": "arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/my-targets/73e2d6bc24d8a067"
}
],
"SslPolicy": "ELBSecurityPolicy-2015-05",
"Certificates": [
{
"CertificateArn": "arn:aws:iam::123456789012:server-certificate/my-new-server-cert"
}
],
}
]
}
For more information, see Listener rules in the Application Load Balancers User Guide.
Output
Listeners -> (list)
Information about the modified listener.
(structure)
Information about a listener.
ListenerArn -> (string)
LoadBalancerArn -> (string)
Port -> (integer)
Protocol -> (string)
Certificates -> (list)
[HTTPS or TLS listener] The default certificate for the listener.
(structure)
Information about an SSL server certificate.
CertificateArn -> (string)
IsDefault -> (boolean)
SslPolicy -> (string)
DefaultActions -> (list)
The default actions for the listener.
(structure)
Information about an action.
Each rule must include exactly one of the following types of actions: forward , fixed-response , or redirect , and it must be the last action to be performed.
Type -> (string)
TargetGroupArn -> (string)
Type is forward and you want to route to a single target group. To route to one or more target groups, use ForwardConfig instead.AuthenticateOidcConfig -> (structure)
[HTTPS listeners] Information about an identity provider that is compliant with OpenID Connect (OIDC). Specify only when Type is authenticate-oidc .
Issuer -> (string)
AuthorizationEndpoint -> (string)
TokenEndpoint -> (string)
UserInfoEndpoint -> (string)
ClientId -> (string)
ClientSecret -> (string)
UseExistingClientSecret to true.SessionCookieName -> (string)
Scope -> (string)
The set of user claims to be requested from the IdP. The default is openid .
To verify which scope values your IdP supports and how to separate multiple values, see the documentation for your IdP.
SessionTimeout -> (long)
AuthenticationRequestExtraParams -> (map)
The query parameters (up to 10) to include in the redirect request to the authorization endpoint.
key -> (string)
value -> (string)
OnUnauthenticatedRequest -> (string)
The behavior if the user is not authenticated. The following are possible values:
- deny- Return an HTTP 401 Unauthorized error.
- allow- Allow the request to be forwarded to the target.
- authenticate- Redirect the request to the IdP authorization endpoint. This is the default value.
UseExistingClientSecret -> (boolean)
AuthenticateCognitoConfig -> (structure)
[HTTPS listeners] Information for using Amazon Cognito to authenticate users. Specify only when Type is authenticate-cognito .
UserPoolArn -> (string)
UserPoolClientId -> (string)
UserPoolDomain -> (string)
SessionCookieName -> (string)
Scope -> (string)
The set of user claims to be requested from the IdP. The default is openid .
To verify which scope values your IdP supports and how to separate multiple values, see the documentation for your IdP.
SessionTimeout -> (long)
AuthenticationRequestExtraParams -> (map)
The query parameters (up to 10) to include in the redirect request to the authorization endpoint.
key -> (string)
value -> (string)
OnUnauthenticatedRequest -> (string)
The behavior if the user is not authenticated. The following are possible values:
- deny- Return an HTTP 401 Unauthorized error.
- allow- Allow the request to be forwarded to the target.
- authenticate- Redirect the request to the IdP authorization endpoint. This is the default value.
Order -> (integer)
RedirectConfig -> (structure)
[Application Load Balancer] Information for creating a redirect action. Specify only when Type is redirect .
Protocol -> (string)
Port -> (string)
Host -> (string)
Path -> (string)
Query -> (string)
StatusCode -> (string)
FixedResponseConfig -> (structure)
[Application Load Balancer] Information for creating an action that returns a custom HTTP response. Specify only when Type is fixed-response .
MessageBody -> (string)
StatusCode -> (string)
ContentType -> (string)
The content type.
Valid Values: text/plain | text/css | text/html | application/javascript | application/json
ForwardConfig -> (structure)
Information for creating an action that distributes requests among one or more target groups. For Network Load Balancers, you can specify a single target group. Specify only when Type is forward . If you specify both ForwardConfig and TargetGroupArn , you can specify only one target group using ForwardConfig and it must be the same target group specified in TargetGroupArn .
TargetGroups -> (list)
The target groups. For Network Load Balancers, you can specify a single target group.
(structure)
Information about how traffic will be distributed between multiple target groups in a forward rule.
TargetGroupArn -> (string)
Weight -> (integer)
TargetGroupStickinessConfig -> (structure)
The target group stickiness for the rule.
Enabled -> (boolean)
DurationSeconds -> (integer)
AlpnPolicy -> (list)
[TLS listener] The name of the Application-Layer Protocol Negotiation (ALPN) policy.
(string)
MutualAuthentication -> (structure)
The mutual authentication configuration information.
Mode -> (string)
off , passthrough or verify . The default value is off .TrustStoreArn -> (string)
IgnoreClientCertificateExpiry -> (boolean)
TrustStoreAssociationStatus -> (string)
AdvertiseTrustStoreCaNames -> (string)
© Copyright 2025, Amazon Web Services. Created using Sphinx.