modify_listener
¶
modify_listener(
*,
config_overrides: Optional[ElasticLoadBalancingv2ClientConfig] = None,
listener_arn: Optional[ListenerArn] = None,
port: Optional[Port] = None,
protocol: Optional[ProtocolEnum] = None,
ssl_policy: Optional[SslPolicyName] = None,
certificates: Optional[CertificateList] = None,
default_actions: Optional[Actions] = None,
alpn_policy: Optional[AlpnPolicyName] = None,
mutual_authentication: Optional[MutualAuthenticationAttributes] = None,
) -> ModifyListenerOutput
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.
Parameters:
-
listener_arn(Optional[ListenerArn], default:None) –The Amazon Resource Name (ARN) of the listener.
-
port(Optional[Port], default:None) –The port for connections from clients to the load balancer. You can't specify a port for a Gateway Load Balancer.
-
protocol(Optional[ProtocolEnum], default:None) –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, TCP_UDP, QUIC, and TCP_QUIC protocols. You can’t change the protocol to UDP, TCP_UDP, QUIC, or TCP_QUIC if dual-stack mode is enabled. You can't specify a protocol for a Gateway Load Balancer.
-
ssl_policy(Optional[SslPolicyName], default:None) –[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(Optional[CertificateList], default:None) –[HTTPS and TLS listeners] The default certificate for the listener. You must provide exactly one certificate. Set
CertificateArnto the certificate ARN but do not setIsDefault. -
default_actions(Optional[Actions], default:None) –The actions for the default rule.
-
alpn_policy(Optional[AlpnPolicyName], default:None) –[TLS listeners] The name of the Application-Layer Protocol Negotiation (ALPN) policy. You can specify one policy name. The following are the possible values:
-
HTTP1Only -
HTTP2Only -
HTTP2Optional -
HTTP2Preferred -
None
For more information, see ALPN policies in the Network Load Balancers Guide.
-
-
mutual_authentication(Optional[MutualAuthenticationAttributes], default:None) –[HTTPS listeners] The mutual authentication configuration information.
Raises:
-
ALPNPolicyNotSupportedException–The specified ALPN policy is not supported.
-
CertificateNotFoundException–The specified certificate does not exist.
-
DuplicateListenerException–A listener with the specified port already exists.
-
IncompatibleProtocolsException–The specified configuration is not valid with this protocol.
-
InvalidConfigurationRequestException–The requested configuration is not valid.
-
InvalidLoadBalancerActionException–The requested action is not valid.
-
ListenerNotFoundException–The specified listener does not exist.
-
SSLPolicyNotFoundException–The specified SSL policy does not exist.
-
TargetGroupAssociationLimitException–You've reached the limit on the number of load balancers per target group.
-
TargetGroupNotFoundException–The specified target group does not exist.
-
TooManyActionsException–You've reached the limit on the number of actions per rule.
-
TooManyCertificatesException–You've reached the limit on the number of certificates per load balancer.
-
TooManyListenersException–You've reached the limit on the number of listeners per load balancer.
-
TooManyRegistrationsForTargetIdException–You've reached the limit on the number of times a target can be registered with a load balancer.
-
TooManyTargetsException–You've reached the limit on the number of targets.
-
TooManyUniqueTargetGroupsPerLoadBalancerException–You've reached the limit on the number of unique target groups per load balancer across all listeners. If a target group is used by multiple actions for a load balancer, it is counted as only one use.
-
TrustStoreNotFoundException–The specified trust store does not exist.
-
TrustStoreNotReadyException–The specified trust store is not active.
-
UnsupportedProtocolException–The specified protocol is not supported.
-
UnknownServiceError–The service returned an error code this client does not model.
Examples:
To change the default action for a listener This example changes the default action for the specified listener.
>>> client.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'}])
To change the server certificate
This example changes the server certificate for the specified HTTPS listener.
>>> client.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'}])
Source code in docs_src/capo_elastic_load_balancing_v2/_services/elastic_load_balancingv2.py
3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 | |