2025/11/12 - Elastic Load Balancing - 7 updated api methods
Changes This release expands ALB Authentication to support JWT verification and adds support for a new JWT validation action in listener rule.
{'DefaultActions': {'JwtValidationConfig': {'AdditionalClaims': [{'Format': 'single-string '
'| '
'string-array '
'| '
'space-separated-values',
'Name': 'string',
'Values': ['string']}],
'Issuer': 'string',
'JwksEndpoint': 'string'},
'Type': {'jwt-validation'}}}
Response {'Listeners': {'DefaultActions': {'JwtValidationConfig': {'AdditionalClaims': [{'Format': 'single-string '
'| '
'string-array '
'| '
'space-separated-values',
'Name': 'string',
'Values': ['string']}],
'Issuer': 'string',
'JwksEndpoint': 'string'},
'Type': {'jwt-validation'}}}}
Creates a listener for the specified Application Load Balancer, Network Load Balancer, or Gateway Load Balancer.
For more information, see the following:
This operation is idempotent, which means that it completes at most one time. If you attempt to create multiple listeners with the same settings, each call succeeds.
See also: AWS API Documentation
Request Syntax
client.create_listener(
LoadBalancerArn='string',
Protocol='HTTP'|'HTTPS'|'TCP'|'TLS'|'UDP'|'TCP_UDP'|'GENEVE',
Port=123,
SslPolicy='string',
Certificates=[
{
'CertificateArn': 'string',
'IsDefault': True|False
},
],
DefaultActions=[
{
'Type': 'forward'|'authenticate-oidc'|'authenticate-cognito'|'redirect'|'fixed-response'|'jwt-validation',
'TargetGroupArn': 'string',
'AuthenticateOidcConfig': {
'Issuer': 'string',
'AuthorizationEndpoint': 'string',
'TokenEndpoint': 'string',
'UserInfoEndpoint': 'string',
'ClientId': 'string',
'ClientSecret': 'string',
'SessionCookieName': 'string',
'Scope': 'string',
'SessionTimeout': 123,
'AuthenticationRequestExtraParams': {
'string': 'string'
},
'OnUnauthenticatedRequest': 'deny'|'allow'|'authenticate',
'UseExistingClientSecret': True|False
},
'AuthenticateCognitoConfig': {
'UserPoolArn': 'string',
'UserPoolClientId': 'string',
'UserPoolDomain': 'string',
'SessionCookieName': 'string',
'Scope': 'string',
'SessionTimeout': 123,
'AuthenticationRequestExtraParams': {
'string': 'string'
},
'OnUnauthenticatedRequest': 'deny'|'allow'|'authenticate'
},
'Order': 123,
'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': 123
},
],
'TargetGroupStickinessConfig': {
'Enabled': True|False,
'DurationSeconds': 123
}
},
'JwtValidationConfig': {
'JwksEndpoint': 'string',
'Issuer': 'string',
'AdditionalClaims': [
{
'Format': 'single-string'|'string-array'|'space-separated-values',
'Name': 'string',
'Values': [
'string',
]
},
]
}
},
],
AlpnPolicy=[
'string',
],
Tags=[
{
'Key': 'string',
'Value': 'string'
},
],
MutualAuthentication={
'Mode': 'string',
'TrustStoreArn': 'string',
'IgnoreClientCertificateExpiry': True|False,
'TrustStoreAssociationStatus': 'active'|'removed',
'AdvertiseTrustStoreCaNames': 'on'|'off'
}
)
string
[REQUIRED]
The Amazon Resource Name (ARN) of the load balancer.
string
The protocol for connections from clients to the load balancer. For Application Load Balancers, the supported protocols are HTTP and HTTPS. For Network Load Balancers, the supported protocols are TCP, TLS, UDP, and TCP_UDP. You can’t specify the UDP or TCP_UDP protocol if dual-stack mode is enabled. You can't specify a protocol for a Gateway Load Balancer.
integer
The port on which the load balancer is listening. You can't specify a port for a Gateway Load Balancer.
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 and Security policies in the Network Load Balancers Guide.
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.
(dict) --
Information about an SSL server certificate.
CertificateArn (string) --
The Amazon Resource Name (ARN) of the certificate.
IsDefault (boolean) --
Indicates whether the certificate is the default certificate. Do not set this value when specifying a certificate as an input. This value is not included in the output when describing a listener, but is included when describing listener certificates.
list
[REQUIRED]
The actions for the default rule.
(dict) --
Information about an action.
Each rule must include exactly one of the following routing actions: forward, fixed-response, or redirect, and it must be the last action to be performed.
Optionally, a rule for an HTTPS listener can also include one of the following user authentication actions: authenticate-oidc, authenticate-cognito, or jwt-validation.
Type (string) -- [REQUIRED]
The type of action.
TargetGroupArn (string) --
The Amazon Resource Name (ARN) of the target group. Specify only when Type is forward and you want to route to a single target group. To route to multiple target groups, you must use ForwardConfig instead.
AuthenticateOidcConfig (dict) --
[HTTPS listeners] Information about an identity provider that is compliant with OpenID Connect (OIDC). Specify only when Type is authenticate-oidc.
Issuer (string) -- [REQUIRED]
The OIDC issuer identifier of the IdP. This must be a full URL, including the HTTPS protocol, the domain, and the path.
AuthorizationEndpoint (string) -- [REQUIRED]
The authorization endpoint of the IdP. This must be a full URL, including the HTTPS protocol, the domain, and the path.
TokenEndpoint (string) -- [REQUIRED]
The token endpoint of the IdP. This must be a full URL, including the HTTPS protocol, the domain, and the path.
UserInfoEndpoint (string) -- [REQUIRED]
The user info endpoint of the IdP. This must be a full URL, including the HTTPS protocol, the domain, and the path.
ClientId (string) -- [REQUIRED]
The OAuth 2.0 client identifier.
ClientSecret (string) --
The OAuth 2.0 client secret. This parameter is required if you are creating a rule. If you are modifying a rule, you can omit this parameter if you set UseExistingClientSecret to true.
SessionCookieName (string) --
The name of the cookie used to maintain session information. The default is AWSELBAuthSessionCookie.
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 (integer) --
The maximum duration of the authentication session, in seconds. The default is 604800 seconds (7 days).
AuthenticationRequestExtraParams (dict) --
The query parameters (up to 10) to include in the redirect request to the authorization endpoint.
(string) --
(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) --
Indicates whether to use the existing client secret when modifying a rule. If you are creating a rule, you can omit this parameter or set it to false.
AuthenticateCognitoConfig (dict) --
[HTTPS listeners] Information for using Amazon Cognito to authenticate users. Specify only when Type is authenticate-cognito.
UserPoolArn (string) -- [REQUIRED]
The Amazon Resource Name (ARN) of the Amazon Cognito user pool.
UserPoolClientId (string) -- [REQUIRED]
The ID of the Amazon Cognito user pool client.
UserPoolDomain (string) -- [REQUIRED]
The domain prefix or fully-qualified domain name of the Amazon Cognito user pool.
SessionCookieName (string) --
The name of the cookie used to maintain session information. The default is AWSELBAuthSessionCookie.
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 (integer) --
The maximum duration of the authentication session, in seconds. The default is 604800 seconds (7 days).
AuthenticationRequestExtraParams (dict) --
The query parameters (up to 10) to include in the redirect request to the authorization endpoint.
(string) --
(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) --
The order for the action. This value is required for rules with multiple actions. The action with the lowest value for order is performed first.
RedirectConfig (dict) --
[Application Load Balancer] Information for creating a redirect action. Specify only when Type is redirect.
Protocol (string) --
The protocol. You can specify HTTP, HTTPS, or #{protocol}. You can redirect HTTP to HTTP, HTTP to HTTPS, and HTTPS to HTTPS. You can't redirect HTTPS to HTTP.
Port (string) --
The port. You can specify a value from 1 to 65535 or #{port}.
Host (string) --
The hostname. This component is not percent-encoded. The hostname can contain #{host}.
Path (string) --
The absolute path, starting with the leading "/". This component is not percent-encoded. The path can contain #{host}, #{path}, and #{port}.
Query (string) --
The query parameters, URL-encoded when necessary, but not percent-encoded. Do not include the leading "?", as it is automatically added. You can specify any of the reserved keywords.
StatusCode (string) -- [REQUIRED]
The HTTP redirect code. The redirect is either permanent (HTTP 301) or temporary (HTTP 302).
FixedResponseConfig (dict) --
[Application Load Balancer] Information for creating an action that returns a custom HTTP response. Specify only when Type is fixed-response.
MessageBody (string) --
The message.
StatusCode (string) -- [REQUIRED]
The HTTP response code (2XX, 4XX, or 5XX).
ContentType (string) --
The content type.
Valid Values: text/plain | text/css | text/html | application/javascript | application/json
ForwardConfig (dict) --
Information for creating an action that distributes requests among multiple target groups. 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.
(dict) --
Information about how traffic will be distributed between multiple target groups in a forward rule.
TargetGroupArn (string) --
The Amazon Resource Name (ARN) of the target group.
Weight (integer) --
The weight. The range is 0 to 999.
TargetGroupStickinessConfig (dict) --
The target group stickiness for the rule.
Enabled (boolean) --
Indicates whether target group stickiness is enabled.
DurationSeconds (integer) --
[Application Load Balancers] The time period, in seconds, during which requests from a client should be routed to the same target group. The range is 1-604800 seconds (7 days). You must specify this value when enabling target group stickiness.
JwtValidationConfig (dict) --
[HTTPS listeners] Information for validating JWT access tokens in client requests. Specify only when Type is jwt-validation.
JwksEndpoint (string) -- [REQUIRED]
The JSON Web Key Set (JWKS) endpoint. This endpoint contains JSON Web Keys (JWK) that are used to validate signatures from the provider.
This must be a full URL, including the HTTPS protocol, the domain, and the path. The maximum length is 256 characters.
Issuer (string) -- [REQUIRED]
The issuer of the JWT. The maximum length is 256 characters.
AdditionalClaims (list) --
Additional claims to validate. The maximum size of the list is 10. We validate the exp, iss, nbf, and iat claims by default.
(dict) --
Information about an additional claim to validate.
Format (string) -- [REQUIRED]
The format of the claim value.
Name (string) -- [REQUIRED]
The name of the claim. You can't specify exp, iss, nbf, or iat because we validate them by default.
Values (list) -- [REQUIRED]
The claim value. The maximum size of the list is 10. Each value can be up to 256 characters in length. If the format is space-separated-values, the values can't include spaces.
(string) --
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:
HTTP1Only
HTTP2Only
HTTP2Optional
HTTP2Preferred
None
For more information, see ALPN policies in the Network Load Balancers Guide.
(string) --
list
The tags to assign to the listener.
(dict) --
Information about a tag.
Key (string) -- [REQUIRED]
The key of the tag.
Value (string) --
The value of the tag.
dict
[HTTPS listeners] The mutual authentication configuration information.
Mode (string) --
The client certificate handling method. Options are off, passthrough or verify. The default value is off.
TrustStoreArn (string) --
The Amazon Resource Name (ARN) of the trust store.
IgnoreClientCertificateExpiry (boolean) --
Indicates whether expired client certificates are ignored.
TrustStoreAssociationStatus (string) --
Indicates a shared trust stores association status.
AdvertiseTrustStoreCaNames (string) --
Indicates whether trust store CA certificate names are advertised.
dict
Response Syntax
{
'Listeners': [
{
'ListenerArn': 'string',
'LoadBalancerArn': 'string',
'Port': 123,
'Protocol': 'HTTP'|'HTTPS'|'TCP'|'TLS'|'UDP'|'TCP_UDP'|'GENEVE',
'Certificates': [
{
'CertificateArn': 'string',
'IsDefault': True|False
},
],
'SslPolicy': 'string',
'DefaultActions': [
{
'Type': 'forward'|'authenticate-oidc'|'authenticate-cognito'|'redirect'|'fixed-response'|'jwt-validation',
'TargetGroupArn': 'string',
'AuthenticateOidcConfig': {
'Issuer': 'string',
'AuthorizationEndpoint': 'string',
'TokenEndpoint': 'string',
'UserInfoEndpoint': 'string',
'ClientId': 'string',
'ClientSecret': 'string',
'SessionCookieName': 'string',
'Scope': 'string',
'SessionTimeout': 123,
'AuthenticationRequestExtraParams': {
'string': 'string'
},
'OnUnauthenticatedRequest': 'deny'|'allow'|'authenticate',
'UseExistingClientSecret': True|False
},
'AuthenticateCognitoConfig': {
'UserPoolArn': 'string',
'UserPoolClientId': 'string',
'UserPoolDomain': 'string',
'SessionCookieName': 'string',
'Scope': 'string',
'SessionTimeout': 123,
'AuthenticationRequestExtraParams': {
'string': 'string'
},
'OnUnauthenticatedRequest': 'deny'|'allow'|'authenticate'
},
'Order': 123,
'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': 123
},
],
'TargetGroupStickinessConfig': {
'Enabled': True|False,
'DurationSeconds': 123
}
},
'JwtValidationConfig': {
'JwksEndpoint': 'string',
'Issuer': 'string',
'AdditionalClaims': [
{
'Format': 'single-string'|'string-array'|'space-separated-values',
'Name': 'string',
'Values': [
'string',
]
},
]
}
},
],
'AlpnPolicy': [
'string',
],
'MutualAuthentication': {
'Mode': 'string',
'TrustStoreArn': 'string',
'IgnoreClientCertificateExpiry': True|False,
'TrustStoreAssociationStatus': 'active'|'removed',
'AdvertiseTrustStoreCaNames': 'on'|'off'
}
},
]
}
Response Structure
(dict) --
Listeners (list) --
Information about the listener.
(dict) --
Information about a listener.
ListenerArn (string) --
The Amazon Resource Name (ARN) of the listener.
LoadBalancerArn (string) --
The Amazon Resource Name (ARN) of the load balancer.
Port (integer) --
The port on which the load balancer is listening.
Protocol (string) --
The protocol for connections from clients to the load balancer.
Certificates (list) --
[HTTPS or TLS listener] The default certificate for the listener.
(dict) --
Information about an SSL server certificate.
CertificateArn (string) --
The Amazon Resource Name (ARN) of the certificate.
IsDefault (boolean) --
Indicates whether the certificate is the default certificate. Do not set this value when specifying a certificate as an input. This value is not included in the output when describing a listener, but is included when describing listener certificates.
SslPolicy (string) --
[HTTPS or TLS listener] The security policy that defines which protocols and ciphers are supported.
DefaultActions (list) --
The default actions for the listener.
(dict) --
Information about an action.
Each rule must include exactly one of the following routing actions: forward, fixed-response, or redirect, and it must be the last action to be performed.
Optionally, a rule for an HTTPS listener can also include one of the following user authentication actions: authenticate-oidc, authenticate-cognito, or jwt-validation.
Type (string) --
The type of action.
TargetGroupArn (string) --
The Amazon Resource Name (ARN) of the target group. Specify only when Type is forward and you want to route to a single target group. To route to multiple target groups, you must use ForwardConfig instead.
AuthenticateOidcConfig (dict) --
[HTTPS listeners] Information about an identity provider that is compliant with OpenID Connect (OIDC). Specify only when Type is authenticate-oidc.
Issuer (string) --
The OIDC issuer identifier of the IdP. This must be a full URL, including the HTTPS protocol, the domain, and the path.
AuthorizationEndpoint (string) --
The authorization endpoint of the IdP. This must be a full URL, including the HTTPS protocol, the domain, and the path.
TokenEndpoint (string) --
The token endpoint of the IdP. This must be a full URL, including the HTTPS protocol, the domain, and the path.
UserInfoEndpoint (string) --
The user info endpoint of the IdP. This must be a full URL, including the HTTPS protocol, the domain, and the path.
ClientId (string) --
The OAuth 2.0 client identifier.
ClientSecret (string) --
The OAuth 2.0 client secret. This parameter is required if you are creating a rule. If you are modifying a rule, you can omit this parameter if you set UseExistingClientSecret to true.
SessionCookieName (string) --
The name of the cookie used to maintain session information. The default is AWSELBAuthSessionCookie.
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 (integer) --
The maximum duration of the authentication session, in seconds. The default is 604800 seconds (7 days).
AuthenticationRequestExtraParams (dict) --
The query parameters (up to 10) to include in the redirect request to the authorization endpoint.
(string) --
(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) --
Indicates whether to use the existing client secret when modifying a rule. If you are creating a rule, you can omit this parameter or set it to false.
AuthenticateCognitoConfig (dict) --
[HTTPS listeners] Information for using Amazon Cognito to authenticate users. Specify only when Type is authenticate-cognito.
UserPoolArn (string) --
The Amazon Resource Name (ARN) of the Amazon Cognito user pool.
UserPoolClientId (string) --
The ID of the Amazon Cognito user pool client.
UserPoolDomain (string) --
The domain prefix or fully-qualified domain name of the Amazon Cognito user pool.
SessionCookieName (string) --
The name of the cookie used to maintain session information. The default is AWSELBAuthSessionCookie.
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 (integer) --
The maximum duration of the authentication session, in seconds. The default is 604800 seconds (7 days).
AuthenticationRequestExtraParams (dict) --
The query parameters (up to 10) to include in the redirect request to the authorization endpoint.
(string) --
(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) --
The order for the action. This value is required for rules with multiple actions. The action with the lowest value for order is performed first.
RedirectConfig (dict) --
[Application Load Balancer] Information for creating a redirect action. Specify only when Type is redirect.
Protocol (string) --
The protocol. You can specify HTTP, HTTPS, or #{protocol}. You can redirect HTTP to HTTP, HTTP to HTTPS, and HTTPS to HTTPS. You can't redirect HTTPS to HTTP.
Port (string) --
The port. You can specify a value from 1 to 65535 or #{port}.
Host (string) --
The hostname. This component is not percent-encoded. The hostname can contain #{host}.
Path (string) --
The absolute path, starting with the leading "/". This component is not percent-encoded. The path can contain #{host}, #{path}, and #{port}.
Query (string) --
The query parameters, URL-encoded when necessary, but not percent-encoded. Do not include the leading "?", as it is automatically added. You can specify any of the reserved keywords.
StatusCode (string) --
The HTTP redirect code. The redirect is either permanent (HTTP 301) or temporary (HTTP 302).
FixedResponseConfig (dict) --
[Application Load Balancer] Information for creating an action that returns a custom HTTP response. Specify only when Type is fixed-response.
MessageBody (string) --
The message.
StatusCode (string) --
The HTTP response code (2XX, 4XX, or 5XX).
ContentType (string) --
The content type.
Valid Values: text/plain | text/css | text/html | application/javascript | application/json
ForwardConfig (dict) --
Information for creating an action that distributes requests among multiple target groups. 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.
(dict) --
Information about how traffic will be distributed between multiple target groups in a forward rule.
TargetGroupArn (string) --
The Amazon Resource Name (ARN) of the target group.
Weight (integer) --
The weight. The range is 0 to 999.
TargetGroupStickinessConfig (dict) --
The target group stickiness for the rule.
Enabled (boolean) --
Indicates whether target group stickiness is enabled.
DurationSeconds (integer) --
[Application Load Balancers] The time period, in seconds, during which requests from a client should be routed to the same target group. The range is 1-604800 seconds (7 days). You must specify this value when enabling target group stickiness.
JwtValidationConfig (dict) --
[HTTPS listeners] Information for validating JWT access tokens in client requests. Specify only when Type is jwt-validation.
JwksEndpoint (string) --
The JSON Web Key Set (JWKS) endpoint. This endpoint contains JSON Web Keys (JWK) that are used to validate signatures from the provider.
This must be a full URL, including the HTTPS protocol, the domain, and the path. The maximum length is 256 characters.
Issuer (string) --
The issuer of the JWT. The maximum length is 256 characters.
AdditionalClaims (list) --
Additional claims to validate. The maximum size of the list is 10. We validate the exp, iss, nbf, and iat claims by default.
(dict) --
Information about an additional claim to validate.
Format (string) --
The format of the claim value.
Name (string) --
The name of the claim. You can't specify exp, iss, nbf, or iat because we validate them by default.
Values (list) --
The claim value. The maximum size of the list is 10. Each value can be up to 256 characters in length. If the format is space-separated-values, the values can't include spaces.
(string) --
AlpnPolicy (list) --
[TLS listener] The name of the Application-Layer Protocol Negotiation (ALPN) policy.
(string) --
MutualAuthentication (dict) --
The mutual authentication configuration information.
Mode (string) --
The client certificate handling method. Options are off, passthrough or verify. The default value is off.
TrustStoreArn (string) --
The Amazon Resource Name (ARN) of the trust store.
IgnoreClientCertificateExpiry (boolean) --
Indicates whether expired client certificates are ignored.
TrustStoreAssociationStatus (string) --
Indicates a shared trust stores association status.
AdvertiseTrustStoreCaNames (string) --
Indicates whether trust store CA certificate names are advertised.
{'Actions': {'JwtValidationConfig': {'AdditionalClaims': [{'Format': 'single-string '
'| '
'string-array '
'| '
'space-separated-values',
'Name': 'string',
'Values': ['string']}],
'Issuer': 'string',
'JwksEndpoint': 'string'},
'Type': {'jwt-validation'}}}
Response {'Rules': {'Actions': {'JwtValidationConfig': {'AdditionalClaims': [{'Format': 'single-string '
'| '
'string-array '
'| '
'space-separated-values',
'Name': 'string',
'Values': ['string']}],
'Issuer': 'string',
'JwksEndpoint': 'string'},
'Type': {'jwt-validation'}}}}
Creates a rule for the specified listener. The listener must be associated with an Application Load Balancer.
Each rule consists of a priority, one or more actions, one or more conditions, and up to two optional transforms. Rules are evaluated in priority order, from the lowest value to the highest value. When the conditions for a rule are met, its actions are performed. If the conditions for no rules are met, the actions for the default rule are performed. For more information, see Listener rules in the Application Load Balancers Guide.
See also: AWS API Documentation
Request Syntax
client.create_rule(
ListenerArn='string',
Conditions=[
{
'Field': 'string',
'Values': [
'string',
],
'HostHeaderConfig': {
'Values': [
'string',
],
'RegexValues': [
'string',
]
},
'PathPatternConfig': {
'Values': [
'string',
],
'RegexValues': [
'string',
]
},
'HttpHeaderConfig': {
'HttpHeaderName': 'string',
'Values': [
'string',
],
'RegexValues': [
'string',
]
},
'QueryStringConfig': {
'Values': [
{
'Key': 'string',
'Value': 'string'
},
]
},
'HttpRequestMethodConfig': {
'Values': [
'string',
]
},
'SourceIpConfig': {
'Values': [
'string',
]
},
'RegexValues': [
'string',
]
},
],
Priority=123,
Actions=[
{
'Type': 'forward'|'authenticate-oidc'|'authenticate-cognito'|'redirect'|'fixed-response'|'jwt-validation',
'TargetGroupArn': 'string',
'AuthenticateOidcConfig': {
'Issuer': 'string',
'AuthorizationEndpoint': 'string',
'TokenEndpoint': 'string',
'UserInfoEndpoint': 'string',
'ClientId': 'string',
'ClientSecret': 'string',
'SessionCookieName': 'string',
'Scope': 'string',
'SessionTimeout': 123,
'AuthenticationRequestExtraParams': {
'string': 'string'
},
'OnUnauthenticatedRequest': 'deny'|'allow'|'authenticate',
'UseExistingClientSecret': True|False
},
'AuthenticateCognitoConfig': {
'UserPoolArn': 'string',
'UserPoolClientId': 'string',
'UserPoolDomain': 'string',
'SessionCookieName': 'string',
'Scope': 'string',
'SessionTimeout': 123,
'AuthenticationRequestExtraParams': {
'string': 'string'
},
'OnUnauthenticatedRequest': 'deny'|'allow'|'authenticate'
},
'Order': 123,
'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': 123
},
],
'TargetGroupStickinessConfig': {
'Enabled': True|False,
'DurationSeconds': 123
}
},
'JwtValidationConfig': {
'JwksEndpoint': 'string',
'Issuer': 'string',
'AdditionalClaims': [
{
'Format': 'single-string'|'string-array'|'space-separated-values',
'Name': 'string',
'Values': [
'string',
]
},
]
}
},
],
Tags=[
{
'Key': 'string',
'Value': 'string'
},
],
Transforms=[
{
'Type': 'host-header-rewrite'|'url-rewrite',
'HostHeaderRewriteConfig': {
'Rewrites': [
{
'Regex': 'string',
'Replace': 'string'
},
]
},
'UrlRewriteConfig': {
'Rewrites': [
{
'Regex': 'string',
'Replace': 'string'
},
]
}
},
]
)
string
[REQUIRED]
The Amazon Resource Name (ARN) of the listener.
list
[REQUIRED]
The conditions.
(dict) --
Information about a condition for a rule.
Each rule can optionally include up to one of each of the following conditions: http-request-method, host-header, path-pattern, and source-ip. Each rule can also optionally include one or more of each of the following conditions: http-header and query-string. Note that the value for a condition can't be empty.
For more information, see Quotas for your Application Load Balancers.
Field (string) --
The field in the HTTP request. The following are the possible values:
http-header
http-request-method
host-header
path-pattern
query-string
source-ip
Values (list) --
The condition value. Specify only when Field is host-header or path-pattern. Alternatively, to specify multiple host names or multiple path patterns, use HostHeaderConfig or PathPatternConfig.
If Field is host-header and you are not using HostHeaderConfig, you can specify a single host name (for example, my.example.com) in Values. A host name is case insensitive, can be up to 128 characters in length, and can contain any of the following characters.
A-Z, a-z, 0-9
.
(matches 0 or more characters)
? (matches exactly 1 character)
If Field is path-pattern and you are not using PathPatternConfig, you can specify a single path pattern (for example, /img/*) in Values. A path pattern is case-sensitive, can be up to 128 characters in length, and can contain any of the following characters.
A-Z, a-z, 0-9
_ - . $ / ~ " ' @ : +
& (using &)
(matches 0 or more characters)
? (matches exactly 1 character)
(string) --
HostHeaderConfig (dict) --
Information for a host header condition. Specify only when Field is host-header.
Values (list) --
The host names. The maximum length of each string is 128 characters. The comparison is case insensitive. The following wildcard characters are supported: * (matches 0 or more characters) and ? (matches exactly 1 character). You must include at least one "." character. You can include only alphabetical characters after the final "." character.
If you specify multiple strings, the condition is satisfied if one of the strings matches the host name.
(string) --
RegexValues (list) --
The regular expressions to compare against the host header. The maximum length of each string is 128 characters.
(string) --
PathPatternConfig (dict) --
Information for a path pattern condition. Specify only when Field is path-pattern.
Values (list) --
The path patterns to compare against the request URL. The maximum length of each string is 128 characters. The comparison is case sensitive. The following wildcard characters are supported: * (matches 0 or more characters) and ? (matches exactly 1 character).
If you specify multiple strings, the condition is satisfied if one of them matches the request URL. The path pattern is compared only to the path of the URL, not to its query string. To compare against the query string, use a query string condition.
(string) --
RegexValues (list) --
The regular expressions to compare against the request URL. The maximum length of each string is 128 characters.
(string) --
HttpHeaderConfig (dict) --
Information for an HTTP header condition. Specify only when Field is http-header.
HttpHeaderName (string) --
The name of the HTTP header field. The maximum length is 40 characters. The header name is case insensitive. The allowed characters are specified by RFC 7230. Wildcards are not supported.
You can't use an HTTP header condition to specify the host header. Instead, use a host condition.
Values (list) --
The strings to compare against the value of the HTTP header. The maximum length of each string is 128 characters. The comparison strings are case insensitive. The following wildcard characters are supported: * (matches 0 or more characters) and ? (matches exactly 1 character).
If the same header appears multiple times in the request, we search them in order until a match is found.
If you specify multiple strings, the condition is satisfied if one of the strings matches the value of the HTTP header. To require that all of the strings are a match, create one condition per string.
(string) --
RegexValues (list) --
The regular expression to compare against the HTTP header. The maximum length of each string is 128 characters.
(string) --
QueryStringConfig (dict) --
Information for a query string condition. Specify only when Field is query-string.
Values (list) --
The key/value pairs or values to find in the query string. The maximum length of each string is 128 characters. The comparison is case insensitive. The following wildcard characters are supported: * (matches 0 or more characters) and ? (matches exactly 1 character). To search for a literal '*' or '?' character in a query string, you must escape these characters in Values using a '' character.
If you specify multiple key/value pairs or values, the condition is satisfied if one of them is found in the query string.
(dict) --
Information about a key/value pair.
Key (string) --
The key. You can omit the key.
Value (string) --
The value.
HttpRequestMethodConfig (dict) --
Information for an HTTP method condition. Specify only when Field is http-request-method.
Values (list) --
The name of the request method. The maximum length is 40 characters. The allowed characters are A-Z, hyphen (-), and underscore (_). The comparison is case sensitive. Wildcards are not supported; therefore, the method name must be an exact match.
If you specify multiple strings, the condition is satisfied if one of the strings matches the HTTP request method. We recommend that you route GET and HEAD requests in the same way, because the response to a HEAD request may be cached.
(string) --
SourceIpConfig (dict) --
Information for a source IP condition. Specify only when Field is source-ip.
Values (list) --
The source IP addresses, in CIDR format. You can use both IPv4 and IPv6 addresses. Wildcards are not supported.
If you specify multiple addresses, the condition is satisfied if the source IP address of the request matches one of the CIDR blocks. This condition is not satisfied by the addresses in the X-Forwarded-For header. To search for addresses in the X-Forwarded-For header, use an HTTP header condition.
The total number of values must be less than, or equal to five.
(string) --
RegexValues (list) --
The regular expressions to match against the condition field. The maximum length of each string is 128 characters. Specify only when Field is http-header, host-header, or path-pattern.
(string) --
integer
[REQUIRED]
The rule priority. A listener can't have multiple rules with the same priority.
list
[REQUIRED]
The actions.
(dict) --
Information about an action.
Each rule must include exactly one of the following routing actions: forward, fixed-response, or redirect, and it must be the last action to be performed.
Optionally, a rule for an HTTPS listener can also include one of the following user authentication actions: authenticate-oidc, authenticate-cognito, or jwt-validation.
Type (string) -- [REQUIRED]
The type of action.
TargetGroupArn (string) --
The Amazon Resource Name (ARN) of the target group. Specify only when Type is forward and you want to route to a single target group. To route to multiple target groups, you must use ForwardConfig instead.
AuthenticateOidcConfig (dict) --
[HTTPS listeners] Information about an identity provider that is compliant with OpenID Connect (OIDC). Specify only when Type is authenticate-oidc.
Issuer (string) -- [REQUIRED]
The OIDC issuer identifier of the IdP. This must be a full URL, including the HTTPS protocol, the domain, and the path.
AuthorizationEndpoint (string) -- [REQUIRED]
The authorization endpoint of the IdP. This must be a full URL, including the HTTPS protocol, the domain, and the path.
TokenEndpoint (string) -- [REQUIRED]
The token endpoint of the IdP. This must be a full URL, including the HTTPS protocol, the domain, and the path.
UserInfoEndpoint (string) -- [REQUIRED]
The user info endpoint of the IdP. This must be a full URL, including the HTTPS protocol, the domain, and the path.
ClientId (string) -- [REQUIRED]
The OAuth 2.0 client identifier.
ClientSecret (string) --
The OAuth 2.0 client secret. This parameter is required if you are creating a rule. If you are modifying a rule, you can omit this parameter if you set UseExistingClientSecret to true.
SessionCookieName (string) --
The name of the cookie used to maintain session information. The default is AWSELBAuthSessionCookie.
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 (integer) --
The maximum duration of the authentication session, in seconds. The default is 604800 seconds (7 days).
AuthenticationRequestExtraParams (dict) --
The query parameters (up to 10) to include in the redirect request to the authorization endpoint.
(string) --
(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) --
Indicates whether to use the existing client secret when modifying a rule. If you are creating a rule, you can omit this parameter or set it to false.
AuthenticateCognitoConfig (dict) --
[HTTPS listeners] Information for using Amazon Cognito to authenticate users. Specify only when Type is authenticate-cognito.
UserPoolArn (string) -- [REQUIRED]
The Amazon Resource Name (ARN) of the Amazon Cognito user pool.
UserPoolClientId (string) -- [REQUIRED]
The ID of the Amazon Cognito user pool client.
UserPoolDomain (string) -- [REQUIRED]
The domain prefix or fully-qualified domain name of the Amazon Cognito user pool.
SessionCookieName (string) --
The name of the cookie used to maintain session information. The default is AWSELBAuthSessionCookie.
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 (integer) --
The maximum duration of the authentication session, in seconds. The default is 604800 seconds (7 days).
AuthenticationRequestExtraParams (dict) --
The query parameters (up to 10) to include in the redirect request to the authorization endpoint.
(string) --
(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) --
The order for the action. This value is required for rules with multiple actions. The action with the lowest value for order is performed first.
RedirectConfig (dict) --
[Application Load Balancer] Information for creating a redirect action. Specify only when Type is redirect.
Protocol (string) --
The protocol. You can specify HTTP, HTTPS, or #{protocol}. You can redirect HTTP to HTTP, HTTP to HTTPS, and HTTPS to HTTPS. You can't redirect HTTPS to HTTP.
Port (string) --
The port. You can specify a value from 1 to 65535 or #{port}.
Host (string) --
The hostname. This component is not percent-encoded. The hostname can contain #{host}.
Path (string) --
The absolute path, starting with the leading "/". This component is not percent-encoded. The path can contain #{host}, #{path}, and #{port}.
Query (string) --
The query parameters, URL-encoded when necessary, but not percent-encoded. Do not include the leading "?", as it is automatically added. You can specify any of the reserved keywords.
StatusCode (string) -- [REQUIRED]
The HTTP redirect code. The redirect is either permanent (HTTP 301) or temporary (HTTP 302).
FixedResponseConfig (dict) --
[Application Load Balancer] Information for creating an action that returns a custom HTTP response. Specify only when Type is fixed-response.
MessageBody (string) --
The message.
StatusCode (string) -- [REQUIRED]
The HTTP response code (2XX, 4XX, or 5XX).
ContentType (string) --
The content type.
Valid Values: text/plain | text/css | text/html | application/javascript | application/json
ForwardConfig (dict) --
Information for creating an action that distributes requests among multiple target groups. 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.
(dict) --
Information about how traffic will be distributed between multiple target groups in a forward rule.
TargetGroupArn (string) --
The Amazon Resource Name (ARN) of the target group.
Weight (integer) --
The weight. The range is 0 to 999.
TargetGroupStickinessConfig (dict) --
The target group stickiness for the rule.
Enabled (boolean) --
Indicates whether target group stickiness is enabled.
DurationSeconds (integer) --
[Application Load Balancers] The time period, in seconds, during which requests from a client should be routed to the same target group. The range is 1-604800 seconds (7 days). You must specify this value when enabling target group stickiness.
JwtValidationConfig (dict) --
[HTTPS listeners] Information for validating JWT access tokens in client requests. Specify only when Type is jwt-validation.
JwksEndpoint (string) -- [REQUIRED]
The JSON Web Key Set (JWKS) endpoint. This endpoint contains JSON Web Keys (JWK) that are used to validate signatures from the provider.
This must be a full URL, including the HTTPS protocol, the domain, and the path. The maximum length is 256 characters.
Issuer (string) -- [REQUIRED]
The issuer of the JWT. The maximum length is 256 characters.
AdditionalClaims (list) --
Additional claims to validate. The maximum size of the list is 10. We validate the exp, iss, nbf, and iat claims by default.
(dict) --
Information about an additional claim to validate.
Format (string) -- [REQUIRED]
The format of the claim value.
Name (string) -- [REQUIRED]
The name of the claim. You can't specify exp, iss, nbf, or iat because we validate them by default.
Values (list) -- [REQUIRED]
The claim value. The maximum size of the list is 10. Each value can be up to 256 characters in length. If the format is space-separated-values, the values can't include spaces.
(string) --
list
The tags to assign to the rule.
(dict) --
Information about a tag.
Key (string) -- [REQUIRED]
The key of the tag.
Value (string) --
The value of the tag.
list
The transforms to apply to requests that match this rule. You can add one host header rewrite transform and one URL rewrite transform.
(dict) --
Information about a transform to apply to requests that match a rule. Transforms are applied to requests before they are sent to targets.
Type (string) -- [REQUIRED]
The type of transform.
host-header-rewrite - Rewrite the host header.
url-rewrite - Rewrite the request URL.
HostHeaderRewriteConfig (dict) --
Information about a host header rewrite transform. This transform modifies the host header in an HTTP request. Specify only when Type is host-header-rewrite.
Rewrites (list) --
The host header rewrite transform. Each transform consists of a regular expression to match and a replacement string.
(dict) --
Information about a rewrite transform. This transform matches a pattern and replaces it with the specified string.
Regex (string) -- [REQUIRED]
The regular expression to match in the input string. The maximum length of the string is 1,024 characters.
Replace (string) -- [REQUIRED]
The replacement string to use when rewriting the matched input. The maximum length of the string is 1,024 characters. You can specify capture groups in the regular expression (for example, $1 and $2).
UrlRewriteConfig (dict) --
Information about a URL rewrite transform. This transform modifies the request URL. Specify only when Type is url-rewrite.
Rewrites (list) --
The URL rewrite transform to apply to the request. The transform consists of a regular expression to match and a replacement string.
(dict) --
Information about a rewrite transform. This transform matches a pattern and replaces it with the specified string.
Regex (string) -- [REQUIRED]
The regular expression to match in the input string. The maximum length of the string is 1,024 characters.
Replace (string) -- [REQUIRED]
The replacement string to use when rewriting the matched input. The maximum length of the string is 1,024 characters. You can specify capture groups in the regular expression (for example, $1 and $2).
dict
Response Syntax
{
'Rules': [
{
'RuleArn': 'string',
'Priority': 'string',
'Conditions': [
{
'Field': 'string',
'Values': [
'string',
],
'HostHeaderConfig': {
'Values': [
'string',
],
'RegexValues': [
'string',
]
},
'PathPatternConfig': {
'Values': [
'string',
],
'RegexValues': [
'string',
]
},
'HttpHeaderConfig': {
'HttpHeaderName': 'string',
'Values': [
'string',
],
'RegexValues': [
'string',
]
},
'QueryStringConfig': {
'Values': [
{
'Key': 'string',
'Value': 'string'
},
]
},
'HttpRequestMethodConfig': {
'Values': [
'string',
]
},
'SourceIpConfig': {
'Values': [
'string',
]
},
'RegexValues': [
'string',
]
},
],
'Actions': [
{
'Type': 'forward'|'authenticate-oidc'|'authenticate-cognito'|'redirect'|'fixed-response'|'jwt-validation',
'TargetGroupArn': 'string',
'AuthenticateOidcConfig': {
'Issuer': 'string',
'AuthorizationEndpoint': 'string',
'TokenEndpoint': 'string',
'UserInfoEndpoint': 'string',
'ClientId': 'string',
'ClientSecret': 'string',
'SessionCookieName': 'string',
'Scope': 'string',
'SessionTimeout': 123,
'AuthenticationRequestExtraParams': {
'string': 'string'
},
'OnUnauthenticatedRequest': 'deny'|'allow'|'authenticate',
'UseExistingClientSecret': True|False
},
'AuthenticateCognitoConfig': {
'UserPoolArn': 'string',
'UserPoolClientId': 'string',
'UserPoolDomain': 'string',
'SessionCookieName': 'string',
'Scope': 'string',
'SessionTimeout': 123,
'AuthenticationRequestExtraParams': {
'string': 'string'
},
'OnUnauthenticatedRequest': 'deny'|'allow'|'authenticate'
},
'Order': 123,
'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': 123
},
],
'TargetGroupStickinessConfig': {
'Enabled': True|False,
'DurationSeconds': 123
}
},
'JwtValidationConfig': {
'JwksEndpoint': 'string',
'Issuer': 'string',
'AdditionalClaims': [
{
'Format': 'single-string'|'string-array'|'space-separated-values',
'Name': 'string',
'Values': [
'string',
]
},
]
}
},
],
'IsDefault': True|False,
'Transforms': [
{
'Type': 'host-header-rewrite'|'url-rewrite',
'HostHeaderRewriteConfig': {
'Rewrites': [
{
'Regex': 'string',
'Replace': 'string'
},
]
},
'UrlRewriteConfig': {
'Rewrites': [
{
'Regex': 'string',
'Replace': 'string'
},
]
}
},
]
},
]
}
Response Structure
(dict) --
Rules (list) --
Information about the rule.
(dict) --
Information about a rule.
RuleArn (string) --
The Amazon Resource Name (ARN) of the rule.
Priority (string) --
The priority.
Conditions (list) --
The conditions. Each rule can include zero or one of the following conditions: http-request-method, host-header, path-pattern, and source-ip, and zero or more of the following conditions: http-header and query-string.
(dict) --
Information about a condition for a rule.
Each rule can optionally include up to one of each of the following conditions: http-request-method, host-header, path-pattern, and source-ip. Each rule can also optionally include one or more of each of the following conditions: http-header and query-string. Note that the value for a condition can't be empty.
For more information, see Quotas for your Application Load Balancers.
Field (string) --
The field in the HTTP request. The following are the possible values:
http-header
http-request-method
host-header
path-pattern
query-string
source-ip
Values (list) --
The condition value. Specify only when Field is host-header or path-pattern. Alternatively, to specify multiple host names or multiple path patterns, use HostHeaderConfig or PathPatternConfig.
If Field is host-header and you are not using HostHeaderConfig, you can specify a single host name (for example, my.example.com) in Values. A host name is case insensitive, can be up to 128 characters in length, and can contain any of the following characters.
A-Z, a-z, 0-9
.
(matches 0 or more characters)
? (matches exactly 1 character)
If Field is path-pattern and you are not using PathPatternConfig, you can specify a single path pattern (for example, /img/*) in Values. A path pattern is case-sensitive, can be up to 128 characters in length, and can contain any of the following characters.
A-Z, a-z, 0-9
_ - . $ / ~ " ' @ : +
& (using &)
(matches 0 or more characters)
? (matches exactly 1 character)
(string) --
HostHeaderConfig (dict) --
Information for a host header condition. Specify only when Field is host-header.
Values (list) --
The host names. The maximum length of each string is 128 characters. The comparison is case insensitive. The following wildcard characters are supported: * (matches 0 or more characters) and ? (matches exactly 1 character). You must include at least one "." character. You can include only alphabetical characters after the final "." character.
If you specify multiple strings, the condition is satisfied if one of the strings matches the host name.
(string) --
RegexValues (list) --
The regular expressions to compare against the host header. The maximum length of each string is 128 characters.
(string) --
PathPatternConfig (dict) --
Information for a path pattern condition. Specify only when Field is path-pattern.
Values (list) --
The path patterns to compare against the request URL. The maximum length of each string is 128 characters. The comparison is case sensitive. The following wildcard characters are supported: * (matches 0 or more characters) and ? (matches exactly 1 character).
If you specify multiple strings, the condition is satisfied if one of them matches the request URL. The path pattern is compared only to the path of the URL, not to its query string. To compare against the query string, use a query string condition.
(string) --
RegexValues (list) --
The regular expressions to compare against the request URL. The maximum length of each string is 128 characters.
(string) --
HttpHeaderConfig (dict) --
Information for an HTTP header condition. Specify only when Field is http-header.
HttpHeaderName (string) --
The name of the HTTP header field. The maximum length is 40 characters. The header name is case insensitive. The allowed characters are specified by RFC 7230. Wildcards are not supported.
You can't use an HTTP header condition to specify the host header. Instead, use a host condition.
Values (list) --
The strings to compare against the value of the HTTP header. The maximum length of each string is 128 characters. The comparison strings are case insensitive. The following wildcard characters are supported: * (matches 0 or more characters) and ? (matches exactly 1 character).
If the same header appears multiple times in the request, we search them in order until a match is found.
If you specify multiple strings, the condition is satisfied if one of the strings matches the value of the HTTP header. To require that all of the strings are a match, create one condition per string.
(string) --
RegexValues (list) --
The regular expression to compare against the HTTP header. The maximum length of each string is 128 characters.
(string) --
QueryStringConfig (dict) --
Information for a query string condition. Specify only when Field is query-string.
Values (list) --
The key/value pairs or values to find in the query string. The maximum length of each string is 128 characters. The comparison is case insensitive. The following wildcard characters are supported: * (matches 0 or more characters) and ? (matches exactly 1 character). To search for a literal '*' or '?' character in a query string, you must escape these characters in Values using a '' character.
If you specify multiple key/value pairs or values, the condition is satisfied if one of them is found in the query string.
(dict) --
Information about a key/value pair.
Key (string) --
The key. You can omit the key.
Value (string) --
The value.
HttpRequestMethodConfig (dict) --
Information for an HTTP method condition. Specify only when Field is http-request-method.
Values (list) --
The name of the request method. The maximum length is 40 characters. The allowed characters are A-Z, hyphen (-), and underscore (_). The comparison is case sensitive. Wildcards are not supported; therefore, the method name must be an exact match.
If you specify multiple strings, the condition is satisfied if one of the strings matches the HTTP request method. We recommend that you route GET and HEAD requests in the same way, because the response to a HEAD request may be cached.
(string) --
SourceIpConfig (dict) --
Information for a source IP condition. Specify only when Field is source-ip.
Values (list) --
The source IP addresses, in CIDR format. You can use both IPv4 and IPv6 addresses. Wildcards are not supported.
If you specify multiple addresses, the condition is satisfied if the source IP address of the request matches one of the CIDR blocks. This condition is not satisfied by the addresses in the X-Forwarded-For header. To search for addresses in the X-Forwarded-For header, use an HTTP header condition.
The total number of values must be less than, or equal to five.
(string) --
RegexValues (list) --
The regular expressions to match against the condition field. The maximum length of each string is 128 characters. Specify only when Field is http-header, host-header, or path-pattern.
(string) --
Actions (list) --
The actions. Each rule must include exactly one of the following types of actions: forward, redirect, or fixed-response, and it must be the last action to be performed.
(dict) --
Information about an action.
Each rule must include exactly one of the following routing actions: forward, fixed-response, or redirect, and it must be the last action to be performed.
Optionally, a rule for an HTTPS listener can also include one of the following user authentication actions: authenticate-oidc, authenticate-cognito, or jwt-validation.
Type (string) --
The type of action.
TargetGroupArn (string) --
The Amazon Resource Name (ARN) of the target group. Specify only when Type is forward and you want to route to a single target group. To route to multiple target groups, you must use ForwardConfig instead.
AuthenticateOidcConfig (dict) --
[HTTPS listeners] Information about an identity provider that is compliant with OpenID Connect (OIDC). Specify only when Type is authenticate-oidc.
Issuer (string) --
The OIDC issuer identifier of the IdP. This must be a full URL, including the HTTPS protocol, the domain, and the path.
AuthorizationEndpoint (string) --
The authorization endpoint of the IdP. This must be a full URL, including the HTTPS protocol, the domain, and the path.
TokenEndpoint (string) --
The token endpoint of the IdP. This must be a full URL, including the HTTPS protocol, the domain, and the path.
UserInfoEndpoint (string) --
The user info endpoint of the IdP. This must be a full URL, including the HTTPS protocol, the domain, and the path.
ClientId (string) --
The OAuth 2.0 client identifier.
ClientSecret (string) --
The OAuth 2.0 client secret. This parameter is required if you are creating a rule. If you are modifying a rule, you can omit this parameter if you set UseExistingClientSecret to true.
SessionCookieName (string) --
The name of the cookie used to maintain session information. The default is AWSELBAuthSessionCookie.
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 (integer) --
The maximum duration of the authentication session, in seconds. The default is 604800 seconds (7 days).
AuthenticationRequestExtraParams (dict) --
The query parameters (up to 10) to include in the redirect request to the authorization endpoint.
(string) --
(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) --
Indicates whether to use the existing client secret when modifying a rule. If you are creating a rule, you can omit this parameter or set it to false.
AuthenticateCognitoConfig (dict) --
[HTTPS listeners] Information for using Amazon Cognito to authenticate users. Specify only when Type is authenticate-cognito.
UserPoolArn (string) --
The Amazon Resource Name (ARN) of the Amazon Cognito user pool.
UserPoolClientId (string) --
The ID of the Amazon Cognito user pool client.
UserPoolDomain (string) --
The domain prefix or fully-qualified domain name of the Amazon Cognito user pool.
SessionCookieName (string) --
The name of the cookie used to maintain session information. The default is AWSELBAuthSessionCookie.
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 (integer) --
The maximum duration of the authentication session, in seconds. The default is 604800 seconds (7 days).
AuthenticationRequestExtraParams (dict) --
The query parameters (up to 10) to include in the redirect request to the authorization endpoint.
(string) --
(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) --
The order for the action. This value is required for rules with multiple actions. The action with the lowest value for order is performed first.
RedirectConfig (dict) --
[Application Load Balancer] Information for creating a redirect action. Specify only when Type is redirect.
Protocol (string) --
The protocol. You can specify HTTP, HTTPS, or #{protocol}. You can redirect HTTP to HTTP, HTTP to HTTPS, and HTTPS to HTTPS. You can't redirect HTTPS to HTTP.
Port (string) --
The port. You can specify a value from 1 to 65535 or #{port}.
Host (string) --
The hostname. This component is not percent-encoded. The hostname can contain #{host}.
Path (string) --
The absolute path, starting with the leading "/". This component is not percent-encoded. The path can contain #{host}, #{path}, and #{port}.
Query (string) --
The query parameters, URL-encoded when necessary, but not percent-encoded. Do not include the leading "?", as it is automatically added. You can specify any of the reserved keywords.
StatusCode (string) --
The HTTP redirect code. The redirect is either permanent (HTTP 301) or temporary (HTTP 302).
FixedResponseConfig (dict) --
[Application Load Balancer] Information for creating an action that returns a custom HTTP response. Specify only when Type is fixed-response.
MessageBody (string) --
The message.
StatusCode (string) --
The HTTP response code (2XX, 4XX, or 5XX).
ContentType (string) --
The content type.
Valid Values: text/plain | text/css | text/html | application/javascript | application/json
ForwardConfig (dict) --
Information for creating an action that distributes requests among multiple target groups. 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.
(dict) --
Information about how traffic will be distributed between multiple target groups in a forward rule.
TargetGroupArn (string) --
The Amazon Resource Name (ARN) of the target group.
Weight (integer) --
The weight. The range is 0 to 999.
TargetGroupStickinessConfig (dict) --
The target group stickiness for the rule.
Enabled (boolean) --
Indicates whether target group stickiness is enabled.
DurationSeconds (integer) --
[Application Load Balancers] The time period, in seconds, during which requests from a client should be routed to the same target group. The range is 1-604800 seconds (7 days). You must specify this value when enabling target group stickiness.
JwtValidationConfig (dict) --
[HTTPS listeners] Information for validating JWT access tokens in client requests. Specify only when Type is jwt-validation.
JwksEndpoint (string) --
The JSON Web Key Set (JWKS) endpoint. This endpoint contains JSON Web Keys (JWK) that are used to validate signatures from the provider.
This must be a full URL, including the HTTPS protocol, the domain, and the path. The maximum length is 256 characters.
Issuer (string) --
The issuer of the JWT. The maximum length is 256 characters.
AdditionalClaims (list) --
Additional claims to validate. The maximum size of the list is 10. We validate the exp, iss, nbf, and iat claims by default.
(dict) --
Information about an additional claim to validate.
Format (string) --
The format of the claim value.
Name (string) --
The name of the claim. You can't specify exp, iss, nbf, or iat because we validate them by default.
Values (list) --
The claim value. The maximum size of the list is 10. Each value can be up to 256 characters in length. If the format is space-separated-values, the values can't include spaces.
(string) --
IsDefault (boolean) --
Indicates whether this is the default rule.
Transforms (list) --
The transforms for the rule.
(dict) --
Information about a transform to apply to requests that match a rule. Transforms are applied to requests before they are sent to targets.
Type (string) --
The type of transform.
host-header-rewrite - Rewrite the host header.
url-rewrite - Rewrite the request URL.
HostHeaderRewriteConfig (dict) --
Information about a host header rewrite transform. This transform modifies the host header in an HTTP request. Specify only when Type is host-header-rewrite.
Rewrites (list) --
The host header rewrite transform. Each transform consists of a regular expression to match and a replacement string.
(dict) --
Information about a rewrite transform. This transform matches a pattern and replaces it with the specified string.
Regex (string) --
The regular expression to match in the input string. The maximum length of the string is 1,024 characters.
Replace (string) --
The replacement string to use when rewriting the matched input. The maximum length of the string is 1,024 characters. You can specify capture groups in the regular expression (for example, $1 and $2).
UrlRewriteConfig (dict) --
Information about a URL rewrite transform. This transform modifies the request URL. Specify only when Type is url-rewrite.
Rewrites (list) --
The URL rewrite transform to apply to the request. The transform consists of a regular expression to match and a replacement string.
(dict) --
Information about a rewrite transform. This transform matches a pattern and replaces it with the specified string.
Regex (string) --
The regular expression to match in the input string. The maximum length of the string is 1,024 characters.
Replace (string) --
The replacement string to use when rewriting the matched input. The maximum length of the string is 1,024 characters. You can specify capture groups in the regular expression (for example, $1 and $2).
{'Listeners': {'DefaultActions': {'JwtValidationConfig': {'AdditionalClaims': [{'Format': 'single-string '
'| '
'string-array '
'| '
'space-separated-values',
'Name': 'string',
'Values': ['string']}],
'Issuer': 'string',
'JwksEndpoint': 'string'},
'Type': {'jwt-validation'}}}}
Describes the specified listeners or the listeners for the specified Application Load Balancer, Network Load Balancer, or Gateway Load Balancer. You must specify either a load balancer or one or more listeners.
See also: AWS API Documentation
Request Syntax
client.describe_listeners(
LoadBalancerArn='string',
ListenerArns=[
'string',
],
Marker='string',
PageSize=123
)
string
The Amazon Resource Name (ARN) of the load balancer.
list
The Amazon Resource Names (ARN) of the listeners.
(string) --
string
The marker for the next set of results. (You received this marker from a previous call.)
integer
The maximum number of results to return with this call.
dict
Response Syntax
{
'Listeners': [
{
'ListenerArn': 'string',
'LoadBalancerArn': 'string',
'Port': 123,
'Protocol': 'HTTP'|'HTTPS'|'TCP'|'TLS'|'UDP'|'TCP_UDP'|'GENEVE',
'Certificates': [
{
'CertificateArn': 'string',
'IsDefault': True|False
},
],
'SslPolicy': 'string',
'DefaultActions': [
{
'Type': 'forward'|'authenticate-oidc'|'authenticate-cognito'|'redirect'|'fixed-response'|'jwt-validation',
'TargetGroupArn': 'string',
'AuthenticateOidcConfig': {
'Issuer': 'string',
'AuthorizationEndpoint': 'string',
'TokenEndpoint': 'string',
'UserInfoEndpoint': 'string',
'ClientId': 'string',
'ClientSecret': 'string',
'SessionCookieName': 'string',
'Scope': 'string',
'SessionTimeout': 123,
'AuthenticationRequestExtraParams': {
'string': 'string'
},
'OnUnauthenticatedRequest': 'deny'|'allow'|'authenticate',
'UseExistingClientSecret': True|False
},
'AuthenticateCognitoConfig': {
'UserPoolArn': 'string',
'UserPoolClientId': 'string',
'UserPoolDomain': 'string',
'SessionCookieName': 'string',
'Scope': 'string',
'SessionTimeout': 123,
'AuthenticationRequestExtraParams': {
'string': 'string'
},
'OnUnauthenticatedRequest': 'deny'|'allow'|'authenticate'
},
'Order': 123,
'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': 123
},
],
'TargetGroupStickinessConfig': {
'Enabled': True|False,
'DurationSeconds': 123
}
},
'JwtValidationConfig': {
'JwksEndpoint': 'string',
'Issuer': 'string',
'AdditionalClaims': [
{
'Format': 'single-string'|'string-array'|'space-separated-values',
'Name': 'string',
'Values': [
'string',
]
},
]
}
},
],
'AlpnPolicy': [
'string',
],
'MutualAuthentication': {
'Mode': 'string',
'TrustStoreArn': 'string',
'IgnoreClientCertificateExpiry': True|False,
'TrustStoreAssociationStatus': 'active'|'removed',
'AdvertiseTrustStoreCaNames': 'on'|'off'
}
},
],
'NextMarker': 'string'
}
Response Structure
(dict) --
Listeners (list) --
Information about the listeners.
(dict) --
Information about a listener.
ListenerArn (string) --
The Amazon Resource Name (ARN) of the listener.
LoadBalancerArn (string) --
The Amazon Resource Name (ARN) of the load balancer.
Port (integer) --
The port on which the load balancer is listening.
Protocol (string) --
The protocol for connections from clients to the load balancer.
Certificates (list) --
[HTTPS or TLS listener] The default certificate for the listener.
(dict) --
Information about an SSL server certificate.
CertificateArn (string) --
The Amazon Resource Name (ARN) of the certificate.
IsDefault (boolean) --
Indicates whether the certificate is the default certificate. Do not set this value when specifying a certificate as an input. This value is not included in the output when describing a listener, but is included when describing listener certificates.
SslPolicy (string) --
[HTTPS or TLS listener] The security policy that defines which protocols and ciphers are supported.
DefaultActions (list) --
The default actions for the listener.
(dict) --
Information about an action.
Each rule must include exactly one of the following routing actions: forward, fixed-response, or redirect, and it must be the last action to be performed.
Optionally, a rule for an HTTPS listener can also include one of the following user authentication actions: authenticate-oidc, authenticate-cognito, or jwt-validation.
Type (string) --
The type of action.
TargetGroupArn (string) --
The Amazon Resource Name (ARN) of the target group. Specify only when Type is forward and you want to route to a single target group. To route to multiple target groups, you must use ForwardConfig instead.
AuthenticateOidcConfig (dict) --
[HTTPS listeners] Information about an identity provider that is compliant with OpenID Connect (OIDC). Specify only when Type is authenticate-oidc.
Issuer (string) --
The OIDC issuer identifier of the IdP. This must be a full URL, including the HTTPS protocol, the domain, and the path.
AuthorizationEndpoint (string) --
The authorization endpoint of the IdP. This must be a full URL, including the HTTPS protocol, the domain, and the path.
TokenEndpoint (string) --
The token endpoint of the IdP. This must be a full URL, including the HTTPS protocol, the domain, and the path.
UserInfoEndpoint (string) --
The user info endpoint of the IdP. This must be a full URL, including the HTTPS protocol, the domain, and the path.
ClientId (string) --
The OAuth 2.0 client identifier.
ClientSecret (string) --
The OAuth 2.0 client secret. This parameter is required if you are creating a rule. If you are modifying a rule, you can omit this parameter if you set UseExistingClientSecret to true.
SessionCookieName (string) --
The name of the cookie used to maintain session information. The default is AWSELBAuthSessionCookie.
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 (integer) --
The maximum duration of the authentication session, in seconds. The default is 604800 seconds (7 days).
AuthenticationRequestExtraParams (dict) --
The query parameters (up to 10) to include in the redirect request to the authorization endpoint.
(string) --
(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) --
Indicates whether to use the existing client secret when modifying a rule. If you are creating a rule, you can omit this parameter or set it to false.
AuthenticateCognitoConfig (dict) --
[HTTPS listeners] Information for using Amazon Cognito to authenticate users. Specify only when Type is authenticate-cognito.
UserPoolArn (string) --
The Amazon Resource Name (ARN) of the Amazon Cognito user pool.
UserPoolClientId (string) --
The ID of the Amazon Cognito user pool client.
UserPoolDomain (string) --
The domain prefix or fully-qualified domain name of the Amazon Cognito user pool.
SessionCookieName (string) --
The name of the cookie used to maintain session information. The default is AWSELBAuthSessionCookie.
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 (integer) --
The maximum duration of the authentication session, in seconds. The default is 604800 seconds (7 days).
AuthenticationRequestExtraParams (dict) --
The query parameters (up to 10) to include in the redirect request to the authorization endpoint.
(string) --
(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) --
The order for the action. This value is required for rules with multiple actions. The action with the lowest value for order is performed first.
RedirectConfig (dict) --
[Application Load Balancer] Information for creating a redirect action. Specify only when Type is redirect.
Protocol (string) --
The protocol. You can specify HTTP, HTTPS, or #{protocol}. You can redirect HTTP to HTTP, HTTP to HTTPS, and HTTPS to HTTPS. You can't redirect HTTPS to HTTP.
Port (string) --
The port. You can specify a value from 1 to 65535 or #{port}.
Host (string) --
The hostname. This component is not percent-encoded. The hostname can contain #{host}.
Path (string) --
The absolute path, starting with the leading "/". This component is not percent-encoded. The path can contain #{host}, #{path}, and #{port}.
Query (string) --
The query parameters, URL-encoded when necessary, but not percent-encoded. Do not include the leading "?", as it is automatically added. You can specify any of the reserved keywords.
StatusCode (string) --
The HTTP redirect code. The redirect is either permanent (HTTP 301) or temporary (HTTP 302).
FixedResponseConfig (dict) --
[Application Load Balancer] Information for creating an action that returns a custom HTTP response. Specify only when Type is fixed-response.
MessageBody (string) --
The message.
StatusCode (string) --
The HTTP response code (2XX, 4XX, or 5XX).
ContentType (string) --
The content type.
Valid Values: text/plain | text/css | text/html | application/javascript | application/json
ForwardConfig (dict) --
Information for creating an action that distributes requests among multiple target groups. 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.
(dict) --
Information about how traffic will be distributed between multiple target groups in a forward rule.
TargetGroupArn (string) --
The Amazon Resource Name (ARN) of the target group.
Weight (integer) --
The weight. The range is 0 to 999.
TargetGroupStickinessConfig (dict) --
The target group stickiness for the rule.
Enabled (boolean) --
Indicates whether target group stickiness is enabled.
DurationSeconds (integer) --
[Application Load Balancers] The time period, in seconds, during which requests from a client should be routed to the same target group. The range is 1-604800 seconds (7 days). You must specify this value when enabling target group stickiness.
JwtValidationConfig (dict) --
[HTTPS listeners] Information for validating JWT access tokens in client requests. Specify only when Type is jwt-validation.
JwksEndpoint (string) --
The JSON Web Key Set (JWKS) endpoint. This endpoint contains JSON Web Keys (JWK) that are used to validate signatures from the provider.
This must be a full URL, including the HTTPS protocol, the domain, and the path. The maximum length is 256 characters.
Issuer (string) --
The issuer of the JWT. The maximum length is 256 characters.
AdditionalClaims (list) --
Additional claims to validate. The maximum size of the list is 10. We validate the exp, iss, nbf, and iat claims by default.
(dict) --
Information about an additional claim to validate.
Format (string) --
The format of the claim value.
Name (string) --
The name of the claim. You can't specify exp, iss, nbf, or iat because we validate them by default.
Values (list) --
The claim value. The maximum size of the list is 10. Each value can be up to 256 characters in length. If the format is space-separated-values, the values can't include spaces.
(string) --
AlpnPolicy (list) --
[TLS listener] The name of the Application-Layer Protocol Negotiation (ALPN) policy.
(string) --
MutualAuthentication (dict) --
The mutual authentication configuration information.
Mode (string) --
The client certificate handling method. Options are off, passthrough or verify. The default value is off.
TrustStoreArn (string) --
The Amazon Resource Name (ARN) of the trust store.
IgnoreClientCertificateExpiry (boolean) --
Indicates whether expired client certificates are ignored.
TrustStoreAssociationStatus (string) --
Indicates a shared trust stores association status.
AdvertiseTrustStoreCaNames (string) --
Indicates whether trust store CA certificate names are advertised.
NextMarker (string) --
If there are additional results, this is the marker for the next set of results. Otherwise, this is null.
{'Rules': {'Actions': {'JwtValidationConfig': {'AdditionalClaims': [{'Format': 'single-string '
'| '
'string-array '
'| '
'space-separated-values',
'Name': 'string',
'Values': ['string']}],
'Issuer': 'string',
'JwksEndpoint': 'string'},
'Type': {'jwt-validation'}}}}
Describes the specified rules or the rules for the specified listener. You must specify either a listener or rules.
See also: AWS API Documentation
Request Syntax
client.describe_rules(
ListenerArn='string',
RuleArns=[
'string',
],
Marker='string',
PageSize=123
)
string
The Amazon Resource Name (ARN) of the listener.
list
The Amazon Resource Names (ARN) of the rules.
(string) --
string
The marker for the next set of results. (You received this marker from a previous call.)
integer
The maximum number of results to return with this call.
dict
Response Syntax
{
'Rules': [
{
'RuleArn': 'string',
'Priority': 'string',
'Conditions': [
{
'Field': 'string',
'Values': [
'string',
],
'HostHeaderConfig': {
'Values': [
'string',
],
'RegexValues': [
'string',
]
},
'PathPatternConfig': {
'Values': [
'string',
],
'RegexValues': [
'string',
]
},
'HttpHeaderConfig': {
'HttpHeaderName': 'string',
'Values': [
'string',
],
'RegexValues': [
'string',
]
},
'QueryStringConfig': {
'Values': [
{
'Key': 'string',
'Value': 'string'
},
]
},
'HttpRequestMethodConfig': {
'Values': [
'string',
]
},
'SourceIpConfig': {
'Values': [
'string',
]
},
'RegexValues': [
'string',
]
},
],
'Actions': [
{
'Type': 'forward'|'authenticate-oidc'|'authenticate-cognito'|'redirect'|'fixed-response'|'jwt-validation',
'TargetGroupArn': 'string',
'AuthenticateOidcConfig': {
'Issuer': 'string',
'AuthorizationEndpoint': 'string',
'TokenEndpoint': 'string',
'UserInfoEndpoint': 'string',
'ClientId': 'string',
'ClientSecret': 'string',
'SessionCookieName': 'string',
'Scope': 'string',
'SessionTimeout': 123,
'AuthenticationRequestExtraParams': {
'string': 'string'
},
'OnUnauthenticatedRequest': 'deny'|'allow'|'authenticate',
'UseExistingClientSecret': True|False
},
'AuthenticateCognitoConfig': {
'UserPoolArn': 'string',
'UserPoolClientId': 'string',
'UserPoolDomain': 'string',
'SessionCookieName': 'string',
'Scope': 'string',
'SessionTimeout': 123,
'AuthenticationRequestExtraParams': {
'string': 'string'
},
'OnUnauthenticatedRequest': 'deny'|'allow'|'authenticate'
},
'Order': 123,
'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': 123
},
],
'TargetGroupStickinessConfig': {
'Enabled': True|False,
'DurationSeconds': 123
}
},
'JwtValidationConfig': {
'JwksEndpoint': 'string',
'Issuer': 'string',
'AdditionalClaims': [
{
'Format': 'single-string'|'string-array'|'space-separated-values',
'Name': 'string',
'Values': [
'string',
]
},
]
}
},
],
'IsDefault': True|False,
'Transforms': [
{
'Type': 'host-header-rewrite'|'url-rewrite',
'HostHeaderRewriteConfig': {
'Rewrites': [
{
'Regex': 'string',
'Replace': 'string'
},
]
},
'UrlRewriteConfig': {
'Rewrites': [
{
'Regex': 'string',
'Replace': 'string'
},
]
}
},
]
},
],
'NextMarker': 'string'
}
Response Structure
(dict) --
Rules (list) --
Information about the rules.
(dict) --
Information about a rule.
RuleArn (string) --
The Amazon Resource Name (ARN) of the rule.
Priority (string) --
The priority.
Conditions (list) --
The conditions. Each rule can include zero or one of the following conditions: http-request-method, host-header, path-pattern, and source-ip, and zero or more of the following conditions: http-header and query-string.
(dict) --
Information about a condition for a rule.
Each rule can optionally include up to one of each of the following conditions: http-request-method, host-header, path-pattern, and source-ip. Each rule can also optionally include one or more of each of the following conditions: http-header and query-string. Note that the value for a condition can't be empty.
For more information, see Quotas for your Application Load Balancers.
Field (string) --
The field in the HTTP request. The following are the possible values:
http-header
http-request-method
host-header
path-pattern
query-string
source-ip
Values (list) --
The condition value. Specify only when Field is host-header or path-pattern. Alternatively, to specify multiple host names or multiple path patterns, use HostHeaderConfig or PathPatternConfig.
If Field is host-header and you are not using HostHeaderConfig, you can specify a single host name (for example, my.example.com) in Values. A host name is case insensitive, can be up to 128 characters in length, and can contain any of the following characters.
A-Z, a-z, 0-9
.
(matches 0 or more characters)
? (matches exactly 1 character)
If Field is path-pattern and you are not using PathPatternConfig, you can specify a single path pattern (for example, /img/*) in Values. A path pattern is case-sensitive, can be up to 128 characters in length, and can contain any of the following characters.
A-Z, a-z, 0-9
_ - . $ / ~ " ' @ : +
& (using &)
(matches 0 or more characters)
? (matches exactly 1 character)
(string) --
HostHeaderConfig (dict) --
Information for a host header condition. Specify only when Field is host-header.
Values (list) --
The host names. The maximum length of each string is 128 characters. The comparison is case insensitive. The following wildcard characters are supported: * (matches 0 or more characters) and ? (matches exactly 1 character). You must include at least one "." character. You can include only alphabetical characters after the final "." character.
If you specify multiple strings, the condition is satisfied if one of the strings matches the host name.
(string) --
RegexValues (list) --
The regular expressions to compare against the host header. The maximum length of each string is 128 characters.
(string) --
PathPatternConfig (dict) --
Information for a path pattern condition. Specify only when Field is path-pattern.
Values (list) --
The path patterns to compare against the request URL. The maximum length of each string is 128 characters. The comparison is case sensitive. The following wildcard characters are supported: * (matches 0 or more characters) and ? (matches exactly 1 character).
If you specify multiple strings, the condition is satisfied if one of them matches the request URL. The path pattern is compared only to the path of the URL, not to its query string. To compare against the query string, use a query string condition.
(string) --
RegexValues (list) --
The regular expressions to compare against the request URL. The maximum length of each string is 128 characters.
(string) --
HttpHeaderConfig (dict) --
Information for an HTTP header condition. Specify only when Field is http-header.
HttpHeaderName (string) --
The name of the HTTP header field. The maximum length is 40 characters. The header name is case insensitive. The allowed characters are specified by RFC 7230. Wildcards are not supported.
You can't use an HTTP header condition to specify the host header. Instead, use a host condition.
Values (list) --
The strings to compare against the value of the HTTP header. The maximum length of each string is 128 characters. The comparison strings are case insensitive. The following wildcard characters are supported: * (matches 0 or more characters) and ? (matches exactly 1 character).
If the same header appears multiple times in the request, we search them in order until a match is found.
If you specify multiple strings, the condition is satisfied if one of the strings matches the value of the HTTP header. To require that all of the strings are a match, create one condition per string.
(string) --
RegexValues (list) --
The regular expression to compare against the HTTP header. The maximum length of each string is 128 characters.
(string) --
QueryStringConfig (dict) --
Information for a query string condition. Specify only when Field is query-string.
Values (list) --
The key/value pairs or values to find in the query string. The maximum length of each string is 128 characters. The comparison is case insensitive. The following wildcard characters are supported: * (matches 0 or more characters) and ? (matches exactly 1 character). To search for a literal '*' or '?' character in a query string, you must escape these characters in Values using a '' character.
If you specify multiple key/value pairs or values, the condition is satisfied if one of them is found in the query string.
(dict) --
Information about a key/value pair.
Key (string) --
The key. You can omit the key.
Value (string) --
The value.
HttpRequestMethodConfig (dict) --
Information for an HTTP method condition. Specify only when Field is http-request-method.
Values (list) --
The name of the request method. The maximum length is 40 characters. The allowed characters are A-Z, hyphen (-), and underscore (_). The comparison is case sensitive. Wildcards are not supported; therefore, the method name must be an exact match.
If you specify multiple strings, the condition is satisfied if one of the strings matches the HTTP request method. We recommend that you route GET and HEAD requests in the same way, because the response to a HEAD request may be cached.
(string) --
SourceIpConfig (dict) --
Information for a source IP condition. Specify only when Field is source-ip.
Values (list) --
The source IP addresses, in CIDR format. You can use both IPv4 and IPv6 addresses. Wildcards are not supported.
If you specify multiple addresses, the condition is satisfied if the source IP address of the request matches one of the CIDR blocks. This condition is not satisfied by the addresses in the X-Forwarded-For header. To search for addresses in the X-Forwarded-For header, use an HTTP header condition.
The total number of values must be less than, or equal to five.
(string) --
RegexValues (list) --
The regular expressions to match against the condition field. The maximum length of each string is 128 characters. Specify only when Field is http-header, host-header, or path-pattern.
(string) --
Actions (list) --
The actions. Each rule must include exactly one of the following types of actions: forward, redirect, or fixed-response, and it must be the last action to be performed.
(dict) --
Information about an action.
Each rule must include exactly one of the following routing actions: forward, fixed-response, or redirect, and it must be the last action to be performed.
Optionally, a rule for an HTTPS listener can also include one of the following user authentication actions: authenticate-oidc, authenticate-cognito, or jwt-validation.
Type (string) --
The type of action.
TargetGroupArn (string) --
The Amazon Resource Name (ARN) of the target group. Specify only when Type is forward and you want to route to a single target group. To route to multiple target groups, you must use ForwardConfig instead.
AuthenticateOidcConfig (dict) --
[HTTPS listeners] Information about an identity provider that is compliant with OpenID Connect (OIDC). Specify only when Type is authenticate-oidc.
Issuer (string) --
The OIDC issuer identifier of the IdP. This must be a full URL, including the HTTPS protocol, the domain, and the path.
AuthorizationEndpoint (string) --
The authorization endpoint of the IdP. This must be a full URL, including the HTTPS protocol, the domain, and the path.
TokenEndpoint (string) --
The token endpoint of the IdP. This must be a full URL, including the HTTPS protocol, the domain, and the path.
UserInfoEndpoint (string) --
The user info endpoint of the IdP. This must be a full URL, including the HTTPS protocol, the domain, and the path.
ClientId (string) --
The OAuth 2.0 client identifier.
ClientSecret (string) --
The OAuth 2.0 client secret. This parameter is required if you are creating a rule. If you are modifying a rule, you can omit this parameter if you set UseExistingClientSecret to true.
SessionCookieName (string) --
The name of the cookie used to maintain session information. The default is AWSELBAuthSessionCookie.
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 (integer) --
The maximum duration of the authentication session, in seconds. The default is 604800 seconds (7 days).
AuthenticationRequestExtraParams (dict) --
The query parameters (up to 10) to include in the redirect request to the authorization endpoint.
(string) --
(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) --
Indicates whether to use the existing client secret when modifying a rule. If you are creating a rule, you can omit this parameter or set it to false.
AuthenticateCognitoConfig (dict) --
[HTTPS listeners] Information for using Amazon Cognito to authenticate users. Specify only when Type is authenticate-cognito.
UserPoolArn (string) --
The Amazon Resource Name (ARN) of the Amazon Cognito user pool.
UserPoolClientId (string) --
The ID of the Amazon Cognito user pool client.
UserPoolDomain (string) --
The domain prefix or fully-qualified domain name of the Amazon Cognito user pool.
SessionCookieName (string) --
The name of the cookie used to maintain session information. The default is AWSELBAuthSessionCookie.
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 (integer) --
The maximum duration of the authentication session, in seconds. The default is 604800 seconds (7 days).
AuthenticationRequestExtraParams (dict) --
The query parameters (up to 10) to include in the redirect request to the authorization endpoint.
(string) --
(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) --
The order for the action. This value is required for rules with multiple actions. The action with the lowest value for order is performed first.
RedirectConfig (dict) --
[Application Load Balancer] Information for creating a redirect action. Specify only when Type is redirect.
Protocol (string) --
The protocol. You can specify HTTP, HTTPS, or #{protocol}. You can redirect HTTP to HTTP, HTTP to HTTPS, and HTTPS to HTTPS. You can't redirect HTTPS to HTTP.
Port (string) --
The port. You can specify a value from 1 to 65535 or #{port}.
Host (string) --
The hostname. This component is not percent-encoded. The hostname can contain #{host}.
Path (string) --
The absolute path, starting with the leading "/". This component is not percent-encoded. The path can contain #{host}, #{path}, and #{port}.
Query (string) --
The query parameters, URL-encoded when necessary, but not percent-encoded. Do not include the leading "?", as it is automatically added. You can specify any of the reserved keywords.
StatusCode (string) --
The HTTP redirect code. The redirect is either permanent (HTTP 301) or temporary (HTTP 302).
FixedResponseConfig (dict) --
[Application Load Balancer] Information for creating an action that returns a custom HTTP response. Specify only when Type is fixed-response.
MessageBody (string) --
The message.
StatusCode (string) --
The HTTP response code (2XX, 4XX, or 5XX).
ContentType (string) --
The content type.
Valid Values: text/plain | text/css | text/html | application/javascript | application/json
ForwardConfig (dict) --
Information for creating an action that distributes requests among multiple target groups. 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.
(dict) --
Information about how traffic will be distributed between multiple target groups in a forward rule.
TargetGroupArn (string) --
The Amazon Resource Name (ARN) of the target group.
Weight (integer) --
The weight. The range is 0 to 999.
TargetGroupStickinessConfig (dict) --
The target group stickiness for the rule.
Enabled (boolean) --
Indicates whether target group stickiness is enabled.
DurationSeconds (integer) --
[Application Load Balancers] The time period, in seconds, during which requests from a client should be routed to the same target group. The range is 1-604800 seconds (7 days). You must specify this value when enabling target group stickiness.
JwtValidationConfig (dict) --
[HTTPS listeners] Information for validating JWT access tokens in client requests. Specify only when Type is jwt-validation.
JwksEndpoint (string) --
The JSON Web Key Set (JWKS) endpoint. This endpoint contains JSON Web Keys (JWK) that are used to validate signatures from the provider.
This must be a full URL, including the HTTPS protocol, the domain, and the path. The maximum length is 256 characters.
Issuer (string) --
The issuer of the JWT. The maximum length is 256 characters.
AdditionalClaims (list) --
Additional claims to validate. The maximum size of the list is 10. We validate the exp, iss, nbf, and iat claims by default.
(dict) --
Information about an additional claim to validate.
Format (string) --
The format of the claim value.
Name (string) --
The name of the claim. You can't specify exp, iss, nbf, or iat because we validate them by default.
Values (list) --
The claim value. The maximum size of the list is 10. Each value can be up to 256 characters in length. If the format is space-separated-values, the values can't include spaces.
(string) --
IsDefault (boolean) --
Indicates whether this is the default rule.
Transforms (list) --
The transforms for the rule.
(dict) --
Information about a transform to apply to requests that match a rule. Transforms are applied to requests before they are sent to targets.
Type (string) --
The type of transform.
host-header-rewrite - Rewrite the host header.
url-rewrite - Rewrite the request URL.
HostHeaderRewriteConfig (dict) --
Information about a host header rewrite transform. This transform modifies the host header in an HTTP request. Specify only when Type is host-header-rewrite.
Rewrites (list) --
The host header rewrite transform. Each transform consists of a regular expression to match and a replacement string.
(dict) --
Information about a rewrite transform. This transform matches a pattern and replaces it with the specified string.
Regex (string) --
The regular expression to match in the input string. The maximum length of the string is 1,024 characters.
Replace (string) --
The replacement string to use when rewriting the matched input. The maximum length of the string is 1,024 characters. You can specify capture groups in the regular expression (for example, $1 and $2).
UrlRewriteConfig (dict) --
Information about a URL rewrite transform. This transform modifies the request URL. Specify only when Type is url-rewrite.
Rewrites (list) --
The URL rewrite transform to apply to the request. The transform consists of a regular expression to match and a replacement string.
(dict) --
Information about a rewrite transform. This transform matches a pattern and replaces it with the specified string.
Regex (string) --
The regular expression to match in the input string. The maximum length of the string is 1,024 characters.
Replace (string) --
The replacement string to use when rewriting the matched input. The maximum length of the string is 1,024 characters. You can specify capture groups in the regular expression (for example, $1 and $2).
NextMarker (string) --
If there are additional results, this is the marker for the next set of results. Otherwise, this is null.
{'DefaultActions': {'JwtValidationConfig': {'AdditionalClaims': [{'Format': 'single-string '
'| '
'string-array '
'| '
'space-separated-values',
'Name': 'string',
'Values': ['string']}],
'Issuer': 'string',
'JwksEndpoint': 'string'},
'Type': {'jwt-validation'}}}
Response {'Listeners': {'DefaultActions': {'JwtValidationConfig': {'AdditionalClaims': [{'Format': 'single-string '
'| '
'string-array '
'| '
'space-separated-values',
'Name': 'string',
'Values': ['string']}],
'Issuer': 'string',
'JwksEndpoint': 'string'},
'Type': {'jwt-validation'}}}}
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
Request Syntax
client.modify_listener(
ListenerArn='string',
Port=123,
Protocol='HTTP'|'HTTPS'|'TCP'|'TLS'|'UDP'|'TCP_UDP'|'GENEVE',
SslPolicy='string',
Certificates=[
{
'CertificateArn': 'string',
'IsDefault': True|False
},
],
DefaultActions=[
{
'Type': 'forward'|'authenticate-oidc'|'authenticate-cognito'|'redirect'|'fixed-response'|'jwt-validation',
'TargetGroupArn': 'string',
'AuthenticateOidcConfig': {
'Issuer': 'string',
'AuthorizationEndpoint': 'string',
'TokenEndpoint': 'string',
'UserInfoEndpoint': 'string',
'ClientId': 'string',
'ClientSecret': 'string',
'SessionCookieName': 'string',
'Scope': 'string',
'SessionTimeout': 123,
'AuthenticationRequestExtraParams': {
'string': 'string'
},
'OnUnauthenticatedRequest': 'deny'|'allow'|'authenticate',
'UseExistingClientSecret': True|False
},
'AuthenticateCognitoConfig': {
'UserPoolArn': 'string',
'UserPoolClientId': 'string',
'UserPoolDomain': 'string',
'SessionCookieName': 'string',
'Scope': 'string',
'SessionTimeout': 123,
'AuthenticationRequestExtraParams': {
'string': 'string'
},
'OnUnauthenticatedRequest': 'deny'|'allow'|'authenticate'
},
'Order': 123,
'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': 123
},
],
'TargetGroupStickinessConfig': {
'Enabled': True|False,
'DurationSeconds': 123
}
},
'JwtValidationConfig': {
'JwksEndpoint': 'string',
'Issuer': 'string',
'AdditionalClaims': [
{
'Format': 'single-string'|'string-array'|'space-separated-values',
'Name': 'string',
'Values': [
'string',
]
},
]
}
},
],
AlpnPolicy=[
'string',
],
MutualAuthentication={
'Mode': 'string',
'TrustStoreArn': 'string',
'IgnoreClientCertificateExpiry': True|False,
'TrustStoreAssociationStatus': 'active'|'removed',
'AdvertiseTrustStoreCaNames': 'on'|'off'
}
)
string
[REQUIRED]
The Amazon Resource Name (ARN) of the listener.
integer
The port for connections from clients to the load balancer. You can't specify a port for a Gateway Load Balancer.
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.
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.
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.
(dict) --
Information about an SSL server certificate.
CertificateArn (string) --
The Amazon Resource Name (ARN) of the certificate.
IsDefault (boolean) --
Indicates whether the certificate is the default certificate. Do not set this value when specifying a certificate as an input. This value is not included in the output when describing a listener, but is included when describing listener certificates.
list
The actions for the default rule.
(dict) --
Information about an action.
Each rule must include exactly one of the following routing actions: forward, fixed-response, or redirect, and it must be the last action to be performed.
Optionally, a rule for an HTTPS listener can also include one of the following user authentication actions: authenticate-oidc, authenticate-cognito, or jwt-validation.
Type (string) -- [REQUIRED]
The type of action.
TargetGroupArn (string) --
The Amazon Resource Name (ARN) of the target group. Specify only when Type is forward and you want to route to a single target group. To route to multiple target groups, you must use ForwardConfig instead.
AuthenticateOidcConfig (dict) --
[HTTPS listeners] Information about an identity provider that is compliant with OpenID Connect (OIDC). Specify only when Type is authenticate-oidc.
Issuer (string) -- [REQUIRED]
The OIDC issuer identifier of the IdP. This must be a full URL, including the HTTPS protocol, the domain, and the path.
AuthorizationEndpoint (string) -- [REQUIRED]
The authorization endpoint of the IdP. This must be a full URL, including the HTTPS protocol, the domain, and the path.
TokenEndpoint (string) -- [REQUIRED]
The token endpoint of the IdP. This must be a full URL, including the HTTPS protocol, the domain, and the path.
UserInfoEndpoint (string) -- [REQUIRED]
The user info endpoint of the IdP. This must be a full URL, including the HTTPS protocol, the domain, and the path.
ClientId (string) -- [REQUIRED]
The OAuth 2.0 client identifier.
ClientSecret (string) --
The OAuth 2.0 client secret. This parameter is required if you are creating a rule. If you are modifying a rule, you can omit this parameter if you set UseExistingClientSecret to true.
SessionCookieName (string) --
The name of the cookie used to maintain session information. The default is AWSELBAuthSessionCookie.
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 (integer) --
The maximum duration of the authentication session, in seconds. The default is 604800 seconds (7 days).
AuthenticationRequestExtraParams (dict) --
The query parameters (up to 10) to include in the redirect request to the authorization endpoint.
(string) --
(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) --
Indicates whether to use the existing client secret when modifying a rule. If you are creating a rule, you can omit this parameter or set it to false.
AuthenticateCognitoConfig (dict) --
[HTTPS listeners] Information for using Amazon Cognito to authenticate users. Specify only when Type is authenticate-cognito.
UserPoolArn (string) -- [REQUIRED]
The Amazon Resource Name (ARN) of the Amazon Cognito user pool.
UserPoolClientId (string) -- [REQUIRED]
The ID of the Amazon Cognito user pool client.
UserPoolDomain (string) -- [REQUIRED]
The domain prefix or fully-qualified domain name of the Amazon Cognito user pool.
SessionCookieName (string) --
The name of the cookie used to maintain session information. The default is AWSELBAuthSessionCookie.
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 (integer) --
The maximum duration of the authentication session, in seconds. The default is 604800 seconds (7 days).
AuthenticationRequestExtraParams (dict) --
The query parameters (up to 10) to include in the redirect request to the authorization endpoint.
(string) --
(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) --
The order for the action. This value is required for rules with multiple actions. The action with the lowest value for order is performed first.
RedirectConfig (dict) --
[Application Load Balancer] Information for creating a redirect action. Specify only when Type is redirect.
Protocol (string) --
The protocol. You can specify HTTP, HTTPS, or #{protocol}. You can redirect HTTP to HTTP, HTTP to HTTPS, and HTTPS to HTTPS. You can't redirect HTTPS to HTTP.
Port (string) --
The port. You can specify a value from 1 to 65535 or #{port}.
Host (string) --
The hostname. This component is not percent-encoded. The hostname can contain #{host}.
Path (string) --
The absolute path, starting with the leading "/". This component is not percent-encoded. The path can contain #{host}, #{path}, and #{port}.
Query (string) --
The query parameters, URL-encoded when necessary, but not percent-encoded. Do not include the leading "?", as it is automatically added. You can specify any of the reserved keywords.
StatusCode (string) -- [REQUIRED]
The HTTP redirect code. The redirect is either permanent (HTTP 301) or temporary (HTTP 302).
FixedResponseConfig (dict) --
[Application Load Balancer] Information for creating an action that returns a custom HTTP response. Specify only when Type is fixed-response.
MessageBody (string) --
The message.
StatusCode (string) -- [REQUIRED]
The HTTP response code (2XX, 4XX, or 5XX).
ContentType (string) --
The content type.
Valid Values: text/plain | text/css | text/html | application/javascript | application/json
ForwardConfig (dict) --
Information for creating an action that distributes requests among multiple target groups. 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.
(dict) --
Information about how traffic will be distributed between multiple target groups in a forward rule.
TargetGroupArn (string) --
The Amazon Resource Name (ARN) of the target group.
Weight (integer) --
The weight. The range is 0 to 999.
TargetGroupStickinessConfig (dict) --
The target group stickiness for the rule.
Enabled (boolean) --
Indicates whether target group stickiness is enabled.
DurationSeconds (integer) --
[Application Load Balancers] The time period, in seconds, during which requests from a client should be routed to the same target group. The range is 1-604800 seconds (7 days). You must specify this value when enabling target group stickiness.
JwtValidationConfig (dict) --
[HTTPS listeners] Information for validating JWT access tokens in client requests. Specify only when Type is jwt-validation.
JwksEndpoint (string) -- [REQUIRED]
The JSON Web Key Set (JWKS) endpoint. This endpoint contains JSON Web Keys (JWK) that are used to validate signatures from the provider.
This must be a full URL, including the HTTPS protocol, the domain, and the path. The maximum length is 256 characters.
Issuer (string) -- [REQUIRED]
The issuer of the JWT. The maximum length is 256 characters.
AdditionalClaims (list) --
Additional claims to validate. The maximum size of the list is 10. We validate the exp, iss, nbf, and iat claims by default.
(dict) --
Information about an additional claim to validate.
Format (string) -- [REQUIRED]
The format of the claim value.
Name (string) -- [REQUIRED]
The name of the claim. You can't specify exp, iss, nbf, or iat because we validate them by default.
Values (list) -- [REQUIRED]
The claim value. The maximum size of the list is 10. Each value can be up to 256 characters in length. If the format is space-separated-values, the values can't include spaces.
(string) --
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:
HTTP1Only
HTTP2Only
HTTP2Optional
HTTP2Preferred
None
For more information, see ALPN policies in the Network Load Balancers Guide.
(string) --
dict
[HTTPS listeners] The mutual authentication configuration information.
Mode (string) --
The client certificate handling method. Options are off, passthrough or verify. The default value is off.
TrustStoreArn (string) --
The Amazon Resource Name (ARN) of the trust store.
IgnoreClientCertificateExpiry (boolean) --
Indicates whether expired client certificates are ignored.
TrustStoreAssociationStatus (string) --
Indicates a shared trust stores association status.
AdvertiseTrustStoreCaNames (string) --
Indicates whether trust store CA certificate names are advertised.
dict
Response Syntax
{
'Listeners': [
{
'ListenerArn': 'string',
'LoadBalancerArn': 'string',
'Port': 123,
'Protocol': 'HTTP'|'HTTPS'|'TCP'|'TLS'|'UDP'|'TCP_UDP'|'GENEVE',
'Certificates': [
{
'CertificateArn': 'string',
'IsDefault': True|False
},
],
'SslPolicy': 'string',
'DefaultActions': [
{
'Type': 'forward'|'authenticate-oidc'|'authenticate-cognito'|'redirect'|'fixed-response'|'jwt-validation',
'TargetGroupArn': 'string',
'AuthenticateOidcConfig': {
'Issuer': 'string',
'AuthorizationEndpoint': 'string',
'TokenEndpoint': 'string',
'UserInfoEndpoint': 'string',
'ClientId': 'string',
'ClientSecret': 'string',
'SessionCookieName': 'string',
'Scope': 'string',
'SessionTimeout': 123,
'AuthenticationRequestExtraParams': {
'string': 'string'
},
'OnUnauthenticatedRequest': 'deny'|'allow'|'authenticate',
'UseExistingClientSecret': True|False
},
'AuthenticateCognitoConfig': {
'UserPoolArn': 'string',
'UserPoolClientId': 'string',
'UserPoolDomain': 'string',
'SessionCookieName': 'string',
'Scope': 'string',
'SessionTimeout': 123,
'AuthenticationRequestExtraParams': {
'string': 'string'
},
'OnUnauthenticatedRequest': 'deny'|'allow'|'authenticate'
},
'Order': 123,
'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': 123
},
],
'TargetGroupStickinessConfig': {
'Enabled': True|False,
'DurationSeconds': 123
}
},
'JwtValidationConfig': {
'JwksEndpoint': 'string',
'Issuer': 'string',
'AdditionalClaims': [
{
'Format': 'single-string'|'string-array'|'space-separated-values',
'Name': 'string',
'Values': [
'string',
]
},
]
}
},
],
'AlpnPolicy': [
'string',
],
'MutualAuthentication': {
'Mode': 'string',
'TrustStoreArn': 'string',
'IgnoreClientCertificateExpiry': True|False,
'TrustStoreAssociationStatus': 'active'|'removed',
'AdvertiseTrustStoreCaNames': 'on'|'off'
}
},
]
}
Response Structure
(dict) --
Listeners (list) --
Information about the modified listener.
(dict) --
Information about a listener.
ListenerArn (string) --
The Amazon Resource Name (ARN) of the listener.
LoadBalancerArn (string) --
The Amazon Resource Name (ARN) of the load balancer.
Port (integer) --
The port on which the load balancer is listening.
Protocol (string) --
The protocol for connections from clients to the load balancer.
Certificates (list) --
[HTTPS or TLS listener] The default certificate for the listener.
(dict) --
Information about an SSL server certificate.
CertificateArn (string) --
The Amazon Resource Name (ARN) of the certificate.
IsDefault (boolean) --
Indicates whether the certificate is the default certificate. Do not set this value when specifying a certificate as an input. This value is not included in the output when describing a listener, but is included when describing listener certificates.
SslPolicy (string) --
[HTTPS or TLS listener] The security policy that defines which protocols and ciphers are supported.
DefaultActions (list) --
The default actions for the listener.
(dict) --
Information about an action.
Each rule must include exactly one of the following routing actions: forward, fixed-response, or redirect, and it must be the last action to be performed.
Optionally, a rule for an HTTPS listener can also include one of the following user authentication actions: authenticate-oidc, authenticate-cognito, or jwt-validation.
Type (string) --
The type of action.
TargetGroupArn (string) --
The Amazon Resource Name (ARN) of the target group. Specify only when Type is forward and you want to route to a single target group. To route to multiple target groups, you must use ForwardConfig instead.
AuthenticateOidcConfig (dict) --
[HTTPS listeners] Information about an identity provider that is compliant with OpenID Connect (OIDC). Specify only when Type is authenticate-oidc.
Issuer (string) --
The OIDC issuer identifier of the IdP. This must be a full URL, including the HTTPS protocol, the domain, and the path.
AuthorizationEndpoint (string) --
The authorization endpoint of the IdP. This must be a full URL, including the HTTPS protocol, the domain, and the path.
TokenEndpoint (string) --
The token endpoint of the IdP. This must be a full URL, including the HTTPS protocol, the domain, and the path.
UserInfoEndpoint (string) --
The user info endpoint of the IdP. This must be a full URL, including the HTTPS protocol, the domain, and the path.
ClientId (string) --
The OAuth 2.0 client identifier.
ClientSecret (string) --
The OAuth 2.0 client secret. This parameter is required if you are creating a rule. If you are modifying a rule, you can omit this parameter if you set UseExistingClientSecret to true.
SessionCookieName (string) --
The name of the cookie used to maintain session information. The default is AWSELBAuthSessionCookie.
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 (integer) --
The maximum duration of the authentication session, in seconds. The default is 604800 seconds (7 days).
AuthenticationRequestExtraParams (dict) --
The query parameters (up to 10) to include in the redirect request to the authorization endpoint.
(string) --
(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) --
Indicates whether to use the existing client secret when modifying a rule. If you are creating a rule, you can omit this parameter or set it to false.
AuthenticateCognitoConfig (dict) --
[HTTPS listeners] Information for using Amazon Cognito to authenticate users. Specify only when Type is authenticate-cognito.
UserPoolArn (string) --
The Amazon Resource Name (ARN) of the Amazon Cognito user pool.
UserPoolClientId (string) --
The ID of the Amazon Cognito user pool client.
UserPoolDomain (string) --
The domain prefix or fully-qualified domain name of the Amazon Cognito user pool.
SessionCookieName (string) --
The name of the cookie used to maintain session information. The default is AWSELBAuthSessionCookie.
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 (integer) --
The maximum duration of the authentication session, in seconds. The default is 604800 seconds (7 days).
AuthenticationRequestExtraParams (dict) --
The query parameters (up to 10) to include in the redirect request to the authorization endpoint.
(string) --
(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) --
The order for the action. This value is required for rules with multiple actions. The action with the lowest value for order is performed first.
RedirectConfig (dict) --
[Application Load Balancer] Information for creating a redirect action. Specify only when Type is redirect.
Protocol (string) --
The protocol. You can specify HTTP, HTTPS, or #{protocol}. You can redirect HTTP to HTTP, HTTP to HTTPS, and HTTPS to HTTPS. You can't redirect HTTPS to HTTP.
Port (string) --
The port. You can specify a value from 1 to 65535 or #{port}.
Host (string) --
The hostname. This component is not percent-encoded. The hostname can contain #{host}.
Path (string) --
The absolute path, starting with the leading "/". This component is not percent-encoded. The path can contain #{host}, #{path}, and #{port}.
Query (string) --
The query parameters, URL-encoded when necessary, but not percent-encoded. Do not include the leading "?", as it is automatically added. You can specify any of the reserved keywords.
StatusCode (string) --
The HTTP redirect code. The redirect is either permanent (HTTP 301) or temporary (HTTP 302).
FixedResponseConfig (dict) --
[Application Load Balancer] Information for creating an action that returns a custom HTTP response. Specify only when Type is fixed-response.
MessageBody (string) --
The message.
StatusCode (string) --
The HTTP response code (2XX, 4XX, or 5XX).
ContentType (string) --
The content type.
Valid Values: text/plain | text/css | text/html | application/javascript | application/json
ForwardConfig (dict) --
Information for creating an action that distributes requests among multiple target groups. 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.
(dict) --
Information about how traffic will be distributed between multiple target groups in a forward rule.
TargetGroupArn (string) --
The Amazon Resource Name (ARN) of the target group.
Weight (integer) --
The weight. The range is 0 to 999.
TargetGroupStickinessConfig (dict) --
The target group stickiness for the rule.
Enabled (boolean) --
Indicates whether target group stickiness is enabled.
DurationSeconds (integer) --
[Application Load Balancers] The time period, in seconds, during which requests from a client should be routed to the same target group. The range is 1-604800 seconds (7 days). You must specify this value when enabling target group stickiness.
JwtValidationConfig (dict) --
[HTTPS listeners] Information for validating JWT access tokens in client requests. Specify only when Type is jwt-validation.
JwksEndpoint (string) --
The JSON Web Key Set (JWKS) endpoint. This endpoint contains JSON Web Keys (JWK) that are used to validate signatures from the provider.
This must be a full URL, including the HTTPS protocol, the domain, and the path. The maximum length is 256 characters.
Issuer (string) --
The issuer of the JWT. The maximum length is 256 characters.
AdditionalClaims (list) --
Additional claims to validate. The maximum size of the list is 10. We validate the exp, iss, nbf, and iat claims by default.
(dict) --
Information about an additional claim to validate.
Format (string) --
The format of the claim value.
Name (string) --
The name of the claim. You can't specify exp, iss, nbf, or iat because we validate them by default.
Values (list) --
The claim value. The maximum size of the list is 10. Each value can be up to 256 characters in length. If the format is space-separated-values, the values can't include spaces.
(string) --
AlpnPolicy (list) --
[TLS listener] The name of the Application-Layer Protocol Negotiation (ALPN) policy.
(string) --
MutualAuthentication (dict) --
The mutual authentication configuration information.
Mode (string) --
The client certificate handling method. Options are off, passthrough or verify. The default value is off.
TrustStoreArn (string) --
The Amazon Resource Name (ARN) of the trust store.
IgnoreClientCertificateExpiry (boolean) --
Indicates whether expired client certificates are ignored.
TrustStoreAssociationStatus (string) --
Indicates a shared trust stores association status.
AdvertiseTrustStoreCaNames (string) --
Indicates whether trust store CA certificate names are advertised.
{'Actions': {'JwtValidationConfig': {'AdditionalClaims': [{'Format': 'single-string '
'| '
'string-array '
'| '
'space-separated-values',
'Name': 'string',
'Values': ['string']}],
'Issuer': 'string',
'JwksEndpoint': 'string'},
'Type': {'jwt-validation'}}}
Response {'Rules': {'Actions': {'JwtValidationConfig': {'AdditionalClaims': [{'Format': 'single-string '
'| '
'string-array '
'| '
'space-separated-values',
'Name': 'string',
'Values': ['string']}],
'Issuer': 'string',
'JwksEndpoint': 'string'},
'Type': {'jwt-validation'}}}}
Replaces the specified properties of the specified rule. Any properties that you do not specify are unchanged.
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
Request Syntax
client.modify_rule(
RuleArn='string',
Conditions=[
{
'Field': 'string',
'Values': [
'string',
],
'HostHeaderConfig': {
'Values': [
'string',
],
'RegexValues': [
'string',
]
},
'PathPatternConfig': {
'Values': [
'string',
],
'RegexValues': [
'string',
]
},
'HttpHeaderConfig': {
'HttpHeaderName': 'string',
'Values': [
'string',
],
'RegexValues': [
'string',
]
},
'QueryStringConfig': {
'Values': [
{
'Key': 'string',
'Value': 'string'
},
]
},
'HttpRequestMethodConfig': {
'Values': [
'string',
]
},
'SourceIpConfig': {
'Values': [
'string',
]
},
'RegexValues': [
'string',
]
},
],
Actions=[
{
'Type': 'forward'|'authenticate-oidc'|'authenticate-cognito'|'redirect'|'fixed-response'|'jwt-validation',
'TargetGroupArn': 'string',
'AuthenticateOidcConfig': {
'Issuer': 'string',
'AuthorizationEndpoint': 'string',
'TokenEndpoint': 'string',
'UserInfoEndpoint': 'string',
'ClientId': 'string',
'ClientSecret': 'string',
'SessionCookieName': 'string',
'Scope': 'string',
'SessionTimeout': 123,
'AuthenticationRequestExtraParams': {
'string': 'string'
},
'OnUnauthenticatedRequest': 'deny'|'allow'|'authenticate',
'UseExistingClientSecret': True|False
},
'AuthenticateCognitoConfig': {
'UserPoolArn': 'string',
'UserPoolClientId': 'string',
'UserPoolDomain': 'string',
'SessionCookieName': 'string',
'Scope': 'string',
'SessionTimeout': 123,
'AuthenticationRequestExtraParams': {
'string': 'string'
},
'OnUnauthenticatedRequest': 'deny'|'allow'|'authenticate'
},
'Order': 123,
'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': 123
},
],
'TargetGroupStickinessConfig': {
'Enabled': True|False,
'DurationSeconds': 123
}
},
'JwtValidationConfig': {
'JwksEndpoint': 'string',
'Issuer': 'string',
'AdditionalClaims': [
{
'Format': 'single-string'|'string-array'|'space-separated-values',
'Name': 'string',
'Values': [
'string',
]
},
]
}
},
],
Transforms=[
{
'Type': 'host-header-rewrite'|'url-rewrite',
'HostHeaderRewriteConfig': {
'Rewrites': [
{
'Regex': 'string',
'Replace': 'string'
},
]
},
'UrlRewriteConfig': {
'Rewrites': [
{
'Regex': 'string',
'Replace': 'string'
},
]
}
},
],
ResetTransforms=True|False
)
string
[REQUIRED]
The Amazon Resource Name (ARN) of the rule.
list
The conditions.
(dict) --
Information about a condition for a rule.
Each rule can optionally include up to one of each of the following conditions: http-request-method, host-header, path-pattern, and source-ip. Each rule can also optionally include one or more of each of the following conditions: http-header and query-string. Note that the value for a condition can't be empty.
For more information, see Quotas for your Application Load Balancers.
Field (string) --
The field in the HTTP request. The following are the possible values:
http-header
http-request-method
host-header
path-pattern
query-string
source-ip
Values (list) --
The condition value. Specify only when Field is host-header or path-pattern. Alternatively, to specify multiple host names or multiple path patterns, use HostHeaderConfig or PathPatternConfig.
If Field is host-header and you are not using HostHeaderConfig, you can specify a single host name (for example, my.example.com) in Values. A host name is case insensitive, can be up to 128 characters in length, and can contain any of the following characters.
A-Z, a-z, 0-9
.
(matches 0 or more characters)
? (matches exactly 1 character)
If Field is path-pattern and you are not using PathPatternConfig, you can specify a single path pattern (for example, /img/*) in Values. A path pattern is case-sensitive, can be up to 128 characters in length, and can contain any of the following characters.
A-Z, a-z, 0-9
_ - . $ / ~ " ' @ : +
& (using &)
(matches 0 or more characters)
? (matches exactly 1 character)
(string) --
HostHeaderConfig (dict) --
Information for a host header condition. Specify only when Field is host-header.
Values (list) --
The host names. The maximum length of each string is 128 characters. The comparison is case insensitive. The following wildcard characters are supported: * (matches 0 or more characters) and ? (matches exactly 1 character). You must include at least one "." character. You can include only alphabetical characters after the final "." character.
If you specify multiple strings, the condition is satisfied if one of the strings matches the host name.
(string) --
RegexValues (list) --
The regular expressions to compare against the host header. The maximum length of each string is 128 characters.
(string) --
PathPatternConfig (dict) --
Information for a path pattern condition. Specify only when Field is path-pattern.
Values (list) --
The path patterns to compare against the request URL. The maximum length of each string is 128 characters. The comparison is case sensitive. The following wildcard characters are supported: * (matches 0 or more characters) and ? (matches exactly 1 character).
If you specify multiple strings, the condition is satisfied if one of them matches the request URL. The path pattern is compared only to the path of the URL, not to its query string. To compare against the query string, use a query string condition.
(string) --
RegexValues (list) --
The regular expressions to compare against the request URL. The maximum length of each string is 128 characters.
(string) --
HttpHeaderConfig (dict) --
Information for an HTTP header condition. Specify only when Field is http-header.
HttpHeaderName (string) --
The name of the HTTP header field. The maximum length is 40 characters. The header name is case insensitive. The allowed characters are specified by RFC 7230. Wildcards are not supported.
You can't use an HTTP header condition to specify the host header. Instead, use a host condition.
Values (list) --
The strings to compare against the value of the HTTP header. The maximum length of each string is 128 characters. The comparison strings are case insensitive. The following wildcard characters are supported: * (matches 0 or more characters) and ? (matches exactly 1 character).
If the same header appears multiple times in the request, we search them in order until a match is found.
If you specify multiple strings, the condition is satisfied if one of the strings matches the value of the HTTP header. To require that all of the strings are a match, create one condition per string.
(string) --
RegexValues (list) --
The regular expression to compare against the HTTP header. The maximum length of each string is 128 characters.
(string) --
QueryStringConfig (dict) --
Information for a query string condition. Specify only when Field is query-string.
Values (list) --
The key/value pairs or values to find in the query string. The maximum length of each string is 128 characters. The comparison is case insensitive. The following wildcard characters are supported: * (matches 0 or more characters) and ? (matches exactly 1 character). To search for a literal '*' or '?' character in a query string, you must escape these characters in Values using a '' character.
If you specify multiple key/value pairs or values, the condition is satisfied if one of them is found in the query string.
(dict) --
Information about a key/value pair.
Key (string) --
The key. You can omit the key.
Value (string) --
The value.
HttpRequestMethodConfig (dict) --
Information for an HTTP method condition. Specify only when Field is http-request-method.
Values (list) --
The name of the request method. The maximum length is 40 characters. The allowed characters are A-Z, hyphen (-), and underscore (_). The comparison is case sensitive. Wildcards are not supported; therefore, the method name must be an exact match.
If you specify multiple strings, the condition is satisfied if one of the strings matches the HTTP request method. We recommend that you route GET and HEAD requests in the same way, because the response to a HEAD request may be cached.
(string) --
SourceIpConfig (dict) --
Information for a source IP condition. Specify only when Field is source-ip.
Values (list) --
The source IP addresses, in CIDR format. You can use both IPv4 and IPv6 addresses. Wildcards are not supported.
If you specify multiple addresses, the condition is satisfied if the source IP address of the request matches one of the CIDR blocks. This condition is not satisfied by the addresses in the X-Forwarded-For header. To search for addresses in the X-Forwarded-For header, use an HTTP header condition.
The total number of values must be less than, or equal to five.
(string) --
RegexValues (list) --
The regular expressions to match against the condition field. The maximum length of each string is 128 characters. Specify only when Field is http-header, host-header, or path-pattern.
(string) --
list
The actions.
(dict) --
Information about an action.
Each rule must include exactly one of the following routing actions: forward, fixed-response, or redirect, and it must be the last action to be performed.
Optionally, a rule for an HTTPS listener can also include one of the following user authentication actions: authenticate-oidc, authenticate-cognito, or jwt-validation.
Type (string) -- [REQUIRED]
The type of action.
TargetGroupArn (string) --
The Amazon Resource Name (ARN) of the target group. Specify only when Type is forward and you want to route to a single target group. To route to multiple target groups, you must use ForwardConfig instead.
AuthenticateOidcConfig (dict) --
[HTTPS listeners] Information about an identity provider that is compliant with OpenID Connect (OIDC). Specify only when Type is authenticate-oidc.
Issuer (string) -- [REQUIRED]
The OIDC issuer identifier of the IdP. This must be a full URL, including the HTTPS protocol, the domain, and the path.
AuthorizationEndpoint (string) -- [REQUIRED]
The authorization endpoint of the IdP. This must be a full URL, including the HTTPS protocol, the domain, and the path.
TokenEndpoint (string) -- [REQUIRED]
The token endpoint of the IdP. This must be a full URL, including the HTTPS protocol, the domain, and the path.
UserInfoEndpoint (string) -- [REQUIRED]
The user info endpoint of the IdP. This must be a full URL, including the HTTPS protocol, the domain, and the path.
ClientId (string) -- [REQUIRED]
The OAuth 2.0 client identifier.
ClientSecret (string) --
The OAuth 2.0 client secret. This parameter is required if you are creating a rule. If you are modifying a rule, you can omit this parameter if you set UseExistingClientSecret to true.
SessionCookieName (string) --
The name of the cookie used to maintain session information. The default is AWSELBAuthSessionCookie.
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 (integer) --
The maximum duration of the authentication session, in seconds. The default is 604800 seconds (7 days).
AuthenticationRequestExtraParams (dict) --
The query parameters (up to 10) to include in the redirect request to the authorization endpoint.
(string) --
(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) --
Indicates whether to use the existing client secret when modifying a rule. If you are creating a rule, you can omit this parameter or set it to false.
AuthenticateCognitoConfig (dict) --
[HTTPS listeners] Information for using Amazon Cognito to authenticate users. Specify only when Type is authenticate-cognito.
UserPoolArn (string) -- [REQUIRED]
The Amazon Resource Name (ARN) of the Amazon Cognito user pool.
UserPoolClientId (string) -- [REQUIRED]
The ID of the Amazon Cognito user pool client.
UserPoolDomain (string) -- [REQUIRED]
The domain prefix or fully-qualified domain name of the Amazon Cognito user pool.
SessionCookieName (string) --
The name of the cookie used to maintain session information. The default is AWSELBAuthSessionCookie.
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 (integer) --
The maximum duration of the authentication session, in seconds. The default is 604800 seconds (7 days).
AuthenticationRequestExtraParams (dict) --
The query parameters (up to 10) to include in the redirect request to the authorization endpoint.
(string) --
(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) --
The order for the action. This value is required for rules with multiple actions. The action with the lowest value for order is performed first.
RedirectConfig (dict) --
[Application Load Balancer] Information for creating a redirect action. Specify only when Type is redirect.
Protocol (string) --
The protocol. You can specify HTTP, HTTPS, or #{protocol}. You can redirect HTTP to HTTP, HTTP to HTTPS, and HTTPS to HTTPS. You can't redirect HTTPS to HTTP.
Port (string) --
The port. You can specify a value from 1 to 65535 or #{port}.
Host (string) --
The hostname. This component is not percent-encoded. The hostname can contain #{host}.
Path (string) --
The absolute path, starting with the leading "/". This component is not percent-encoded. The path can contain #{host}, #{path}, and #{port}.
Query (string) --
The query parameters, URL-encoded when necessary, but not percent-encoded. Do not include the leading "?", as it is automatically added. You can specify any of the reserved keywords.
StatusCode (string) -- [REQUIRED]
The HTTP redirect code. The redirect is either permanent (HTTP 301) or temporary (HTTP 302).
FixedResponseConfig (dict) --
[Application Load Balancer] Information for creating an action that returns a custom HTTP response. Specify only when Type is fixed-response.
MessageBody (string) --
The message.
StatusCode (string) -- [REQUIRED]
The HTTP response code (2XX, 4XX, or 5XX).
ContentType (string) --
The content type.
Valid Values: text/plain | text/css | text/html | application/javascript | application/json
ForwardConfig (dict) --
Information for creating an action that distributes requests among multiple target groups. 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.
(dict) --
Information about how traffic will be distributed between multiple target groups in a forward rule.
TargetGroupArn (string) --
The Amazon Resource Name (ARN) of the target group.
Weight (integer) --
The weight. The range is 0 to 999.
TargetGroupStickinessConfig (dict) --
The target group stickiness for the rule.
Enabled (boolean) --
Indicates whether target group stickiness is enabled.
DurationSeconds (integer) --
[Application Load Balancers] The time period, in seconds, during which requests from a client should be routed to the same target group. The range is 1-604800 seconds (7 days). You must specify this value when enabling target group stickiness.
JwtValidationConfig (dict) --
[HTTPS listeners] Information for validating JWT access tokens in client requests. Specify only when Type is jwt-validation.
JwksEndpoint (string) -- [REQUIRED]
The JSON Web Key Set (JWKS) endpoint. This endpoint contains JSON Web Keys (JWK) that are used to validate signatures from the provider.
This must be a full URL, including the HTTPS protocol, the domain, and the path. The maximum length is 256 characters.
Issuer (string) -- [REQUIRED]
The issuer of the JWT. The maximum length is 256 characters.
AdditionalClaims (list) --
Additional claims to validate. The maximum size of the list is 10. We validate the exp, iss, nbf, and iat claims by default.
(dict) --
Information about an additional claim to validate.
Format (string) -- [REQUIRED]
The format of the claim value.
Name (string) -- [REQUIRED]
The name of the claim. You can't specify exp, iss, nbf, or iat because we validate them by default.
Values (list) -- [REQUIRED]
The claim value. The maximum size of the list is 10. Each value can be up to 256 characters in length. If the format is space-separated-values, the values can't include spaces.
(string) --
list
The transforms to apply to requests that match this rule. You can add one host header rewrite transform and one URL rewrite transform. If you specify Transforms, you can't specify ResetTransforms.
(dict) --
Information about a transform to apply to requests that match a rule. Transforms are applied to requests before they are sent to targets.
Type (string) -- [REQUIRED]
The type of transform.
host-header-rewrite - Rewrite the host header.
url-rewrite - Rewrite the request URL.
HostHeaderRewriteConfig (dict) --
Information about a host header rewrite transform. This transform modifies the host header in an HTTP request. Specify only when Type is host-header-rewrite.
Rewrites (list) --
The host header rewrite transform. Each transform consists of a regular expression to match and a replacement string.
(dict) --
Information about a rewrite transform. This transform matches a pattern and replaces it with the specified string.
Regex (string) -- [REQUIRED]
The regular expression to match in the input string. The maximum length of the string is 1,024 characters.
Replace (string) -- [REQUIRED]
The replacement string to use when rewriting the matched input. The maximum length of the string is 1,024 characters. You can specify capture groups in the regular expression (for example, $1 and $2).
UrlRewriteConfig (dict) --
Information about a URL rewrite transform. This transform modifies the request URL. Specify only when Type is url-rewrite.
Rewrites (list) --
The URL rewrite transform to apply to the request. The transform consists of a regular expression to match and a replacement string.
(dict) --
Information about a rewrite transform. This transform matches a pattern and replaces it with the specified string.
Regex (string) -- [REQUIRED]
The regular expression to match in the input string. The maximum length of the string is 1,024 characters.
Replace (string) -- [REQUIRED]
The replacement string to use when rewriting the matched input. The maximum length of the string is 1,024 characters. You can specify capture groups in the regular expression (for example, $1 and $2).
boolean
Indicates whether to remove all transforms from the rule. If you specify ResetTransforms, you can't specify Transforms.
dict
Response Syntax
{
'Rules': [
{
'RuleArn': 'string',
'Priority': 'string',
'Conditions': [
{
'Field': 'string',
'Values': [
'string',
],
'HostHeaderConfig': {
'Values': [
'string',
],
'RegexValues': [
'string',
]
},
'PathPatternConfig': {
'Values': [
'string',
],
'RegexValues': [
'string',
]
},
'HttpHeaderConfig': {
'HttpHeaderName': 'string',
'Values': [
'string',
],
'RegexValues': [
'string',
]
},
'QueryStringConfig': {
'Values': [
{
'Key': 'string',
'Value': 'string'
},
]
},
'HttpRequestMethodConfig': {
'Values': [
'string',
]
},
'SourceIpConfig': {
'Values': [
'string',
]
},
'RegexValues': [
'string',
]
},
],
'Actions': [
{
'Type': 'forward'|'authenticate-oidc'|'authenticate-cognito'|'redirect'|'fixed-response'|'jwt-validation',
'TargetGroupArn': 'string',
'AuthenticateOidcConfig': {
'Issuer': 'string',
'AuthorizationEndpoint': 'string',
'TokenEndpoint': 'string',
'UserInfoEndpoint': 'string',
'ClientId': 'string',
'ClientSecret': 'string',
'SessionCookieName': 'string',
'Scope': 'string',
'SessionTimeout': 123,
'AuthenticationRequestExtraParams': {
'string': 'string'
},
'OnUnauthenticatedRequest': 'deny'|'allow'|'authenticate',
'UseExistingClientSecret': True|False
},
'AuthenticateCognitoConfig': {
'UserPoolArn': 'string',
'UserPoolClientId': 'string',
'UserPoolDomain': 'string',
'SessionCookieName': 'string',
'Scope': 'string',
'SessionTimeout': 123,
'AuthenticationRequestExtraParams': {
'string': 'string'
},
'OnUnauthenticatedRequest': 'deny'|'allow'|'authenticate'
},
'Order': 123,
'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': 123
},
],
'TargetGroupStickinessConfig': {
'Enabled': True|False,
'DurationSeconds': 123
}
},
'JwtValidationConfig': {
'JwksEndpoint': 'string',
'Issuer': 'string',
'AdditionalClaims': [
{
'Format': 'single-string'|'string-array'|'space-separated-values',
'Name': 'string',
'Values': [
'string',
]
},
]
}
},
],
'IsDefault': True|False,
'Transforms': [
{
'Type': 'host-header-rewrite'|'url-rewrite',
'HostHeaderRewriteConfig': {
'Rewrites': [
{
'Regex': 'string',
'Replace': 'string'
},
]
},
'UrlRewriteConfig': {
'Rewrites': [
{
'Regex': 'string',
'Replace': 'string'
},
]
}
},
]
},
]
}
Response Structure
(dict) --
Rules (list) --
Information about the modified rule.
(dict) --
Information about a rule.
RuleArn (string) --
The Amazon Resource Name (ARN) of the rule.
Priority (string) --
The priority.
Conditions (list) --
The conditions. Each rule can include zero or one of the following conditions: http-request-method, host-header, path-pattern, and source-ip, and zero or more of the following conditions: http-header and query-string.
(dict) --
Information about a condition for a rule.
Each rule can optionally include up to one of each of the following conditions: http-request-method, host-header, path-pattern, and source-ip. Each rule can also optionally include one or more of each of the following conditions: http-header and query-string. Note that the value for a condition can't be empty.
For more information, see Quotas for your Application Load Balancers.
Field (string) --
The field in the HTTP request. The following are the possible values:
http-header
http-request-method
host-header
path-pattern
query-string
source-ip
Values (list) --
The condition value. Specify only when Field is host-header or path-pattern. Alternatively, to specify multiple host names or multiple path patterns, use HostHeaderConfig or PathPatternConfig.
If Field is host-header and you are not using HostHeaderConfig, you can specify a single host name (for example, my.example.com) in Values. A host name is case insensitive, can be up to 128 characters in length, and can contain any of the following characters.
A-Z, a-z, 0-9
.
(matches 0 or more characters)
? (matches exactly 1 character)
If Field is path-pattern and you are not using PathPatternConfig, you can specify a single path pattern (for example, /img/*) in Values. A path pattern is case-sensitive, can be up to 128 characters in length, and can contain any of the following characters.
A-Z, a-z, 0-9
_ - . $ / ~ " ' @ : +
& (using &)
(matches 0 or more characters)
? (matches exactly 1 character)
(string) --
HostHeaderConfig (dict) --
Information for a host header condition. Specify only when Field is host-header.
Values (list) --
The host names. The maximum length of each string is 128 characters. The comparison is case insensitive. The following wildcard characters are supported: * (matches 0 or more characters) and ? (matches exactly 1 character). You must include at least one "." character. You can include only alphabetical characters after the final "." character.
If you specify multiple strings, the condition is satisfied if one of the strings matches the host name.
(string) --
RegexValues (list) --
The regular expressions to compare against the host header. The maximum length of each string is 128 characters.
(string) --
PathPatternConfig (dict) --
Information for a path pattern condition. Specify only when Field is path-pattern.
Values (list) --
The path patterns to compare against the request URL. The maximum length of each string is 128 characters. The comparison is case sensitive. The following wildcard characters are supported: * (matches 0 or more characters) and ? (matches exactly 1 character).
If you specify multiple strings, the condition is satisfied if one of them matches the request URL. The path pattern is compared only to the path of the URL, not to its query string. To compare against the query string, use a query string condition.
(string) --
RegexValues (list) --
The regular expressions to compare against the request URL. The maximum length of each string is 128 characters.
(string) --
HttpHeaderConfig (dict) --
Information for an HTTP header condition. Specify only when Field is http-header.
HttpHeaderName (string) --
The name of the HTTP header field. The maximum length is 40 characters. The header name is case insensitive. The allowed characters are specified by RFC 7230. Wildcards are not supported.
You can't use an HTTP header condition to specify the host header. Instead, use a host condition.
Values (list) --
The strings to compare against the value of the HTTP header. The maximum length of each string is 128 characters. The comparison strings are case insensitive. The following wildcard characters are supported: * (matches 0 or more characters) and ? (matches exactly 1 character).
If the same header appears multiple times in the request, we search them in order until a match is found.
If you specify multiple strings, the condition is satisfied if one of the strings matches the value of the HTTP header. To require that all of the strings are a match, create one condition per string.
(string) --
RegexValues (list) --
The regular expression to compare against the HTTP header. The maximum length of each string is 128 characters.
(string) --
QueryStringConfig (dict) --
Information for a query string condition. Specify only when Field is query-string.
Values (list) --
The key/value pairs or values to find in the query string. The maximum length of each string is 128 characters. The comparison is case insensitive. The following wildcard characters are supported: * (matches 0 or more characters) and ? (matches exactly 1 character). To search for a literal '*' or '?' character in a query string, you must escape these characters in Values using a '' character.
If you specify multiple key/value pairs or values, the condition is satisfied if one of them is found in the query string.
(dict) --
Information about a key/value pair.
Key (string) --
The key. You can omit the key.
Value (string) --
The value.
HttpRequestMethodConfig (dict) --
Information for an HTTP method condition. Specify only when Field is http-request-method.
Values (list) --
The name of the request method. The maximum length is 40 characters. The allowed characters are A-Z, hyphen (-), and underscore (_). The comparison is case sensitive. Wildcards are not supported; therefore, the method name must be an exact match.
If you specify multiple strings, the condition is satisfied if one of the strings matches the HTTP request method. We recommend that you route GET and HEAD requests in the same way, because the response to a HEAD request may be cached.
(string) --
SourceIpConfig (dict) --
Information for a source IP condition. Specify only when Field is source-ip.
Values (list) --
The source IP addresses, in CIDR format. You can use both IPv4 and IPv6 addresses. Wildcards are not supported.
If you specify multiple addresses, the condition is satisfied if the source IP address of the request matches one of the CIDR blocks. This condition is not satisfied by the addresses in the X-Forwarded-For header. To search for addresses in the X-Forwarded-For header, use an HTTP header condition.
The total number of values must be less than, or equal to five.
(string) --
RegexValues (list) --
The regular expressions to match against the condition field. The maximum length of each string is 128 characters. Specify only when Field is http-header, host-header, or path-pattern.
(string) --
Actions (list) --
The actions. Each rule must include exactly one of the following types of actions: forward, redirect, or fixed-response, and it must be the last action to be performed.
(dict) --
Information about an action.
Each rule must include exactly one of the following routing actions: forward, fixed-response, or redirect, and it must be the last action to be performed.
Optionally, a rule for an HTTPS listener can also include one of the following user authentication actions: authenticate-oidc, authenticate-cognito, or jwt-validation.
Type (string) --
The type of action.
TargetGroupArn (string) --
The Amazon Resource Name (ARN) of the target group. Specify only when Type is forward and you want to route to a single target group. To route to multiple target groups, you must use ForwardConfig instead.
AuthenticateOidcConfig (dict) --
[HTTPS listeners] Information about an identity provider that is compliant with OpenID Connect (OIDC). Specify only when Type is authenticate-oidc.
Issuer (string) --
The OIDC issuer identifier of the IdP. This must be a full URL, including the HTTPS protocol, the domain, and the path.
AuthorizationEndpoint (string) --
The authorization endpoint of the IdP. This must be a full URL, including the HTTPS protocol, the domain, and the path.
TokenEndpoint (string) --
The token endpoint of the IdP. This must be a full URL, including the HTTPS protocol, the domain, and the path.
UserInfoEndpoint (string) --
The user info endpoint of the IdP. This must be a full URL, including the HTTPS protocol, the domain, and the path.
ClientId (string) --
The OAuth 2.0 client identifier.
ClientSecret (string) --
The OAuth 2.0 client secret. This parameter is required if you are creating a rule. If you are modifying a rule, you can omit this parameter if you set UseExistingClientSecret to true.
SessionCookieName (string) --
The name of the cookie used to maintain session information. The default is AWSELBAuthSessionCookie.
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 (integer) --
The maximum duration of the authentication session, in seconds. The default is 604800 seconds (7 days).
AuthenticationRequestExtraParams (dict) --
The query parameters (up to 10) to include in the redirect request to the authorization endpoint.
(string) --
(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) --
Indicates whether to use the existing client secret when modifying a rule. If you are creating a rule, you can omit this parameter or set it to false.
AuthenticateCognitoConfig (dict) --
[HTTPS listeners] Information for using Amazon Cognito to authenticate users. Specify only when Type is authenticate-cognito.
UserPoolArn (string) --
The Amazon Resource Name (ARN) of the Amazon Cognito user pool.
UserPoolClientId (string) --
The ID of the Amazon Cognito user pool client.
UserPoolDomain (string) --
The domain prefix or fully-qualified domain name of the Amazon Cognito user pool.
SessionCookieName (string) --
The name of the cookie used to maintain session information. The default is AWSELBAuthSessionCookie.
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 (integer) --
The maximum duration of the authentication session, in seconds. The default is 604800 seconds (7 days).
AuthenticationRequestExtraParams (dict) --
The query parameters (up to 10) to include in the redirect request to the authorization endpoint.
(string) --
(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) --
The order for the action. This value is required for rules with multiple actions. The action with the lowest value for order is performed first.
RedirectConfig (dict) --
[Application Load Balancer] Information for creating a redirect action. Specify only when Type is redirect.
Protocol (string) --
The protocol. You can specify HTTP, HTTPS, or #{protocol}. You can redirect HTTP to HTTP, HTTP to HTTPS, and HTTPS to HTTPS. You can't redirect HTTPS to HTTP.
Port (string) --
The port. You can specify a value from 1 to 65535 or #{port}.
Host (string) --
The hostname. This component is not percent-encoded. The hostname can contain #{host}.
Path (string) --
The absolute path, starting with the leading "/". This component is not percent-encoded. The path can contain #{host}, #{path}, and #{port}.
Query (string) --
The query parameters, URL-encoded when necessary, but not percent-encoded. Do not include the leading "?", as it is automatically added. You can specify any of the reserved keywords.
StatusCode (string) --
The HTTP redirect code. The redirect is either permanent (HTTP 301) or temporary (HTTP 302).
FixedResponseConfig (dict) --
[Application Load Balancer] Information for creating an action that returns a custom HTTP response. Specify only when Type is fixed-response.
MessageBody (string) --
The message.
StatusCode (string) --
The HTTP response code (2XX, 4XX, or 5XX).
ContentType (string) --
The content type.
Valid Values: text/plain | text/css | text/html | application/javascript | application/json
ForwardConfig (dict) --
Information for creating an action that distributes requests among multiple target groups. 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.
(dict) --
Information about how traffic will be distributed between multiple target groups in a forward rule.
TargetGroupArn (string) --
The Amazon Resource Name (ARN) of the target group.
Weight (integer) --
The weight. The range is 0 to 999.
TargetGroupStickinessConfig (dict) --
The target group stickiness for the rule.
Enabled (boolean) --
Indicates whether target group stickiness is enabled.
DurationSeconds (integer) --
[Application Load Balancers] The time period, in seconds, during which requests from a client should be routed to the same target group. The range is 1-604800 seconds (7 days). You must specify this value when enabling target group stickiness.
JwtValidationConfig (dict) --
[HTTPS listeners] Information for validating JWT access tokens in client requests. Specify only when Type is jwt-validation.
JwksEndpoint (string) --
The JSON Web Key Set (JWKS) endpoint. This endpoint contains JSON Web Keys (JWK) that are used to validate signatures from the provider.
This must be a full URL, including the HTTPS protocol, the domain, and the path. The maximum length is 256 characters.
Issuer (string) --
The issuer of the JWT. The maximum length is 256 characters.
AdditionalClaims (list) --
Additional claims to validate. The maximum size of the list is 10. We validate the exp, iss, nbf, and iat claims by default.
(dict) --
Information about an additional claim to validate.
Format (string) --
The format of the claim value.
Name (string) --
The name of the claim. You can't specify exp, iss, nbf, or iat because we validate them by default.
Values (list) --
The claim value. The maximum size of the list is 10. Each value can be up to 256 characters in length. If the format is space-separated-values, the values can't include spaces.
(string) --
IsDefault (boolean) --
Indicates whether this is the default rule.
Transforms (list) --
The transforms for the rule.
(dict) --
Information about a transform to apply to requests that match a rule. Transforms are applied to requests before they are sent to targets.
Type (string) --
The type of transform.
host-header-rewrite - Rewrite the host header.
url-rewrite - Rewrite the request URL.
HostHeaderRewriteConfig (dict) --
Information about a host header rewrite transform. This transform modifies the host header in an HTTP request. Specify only when Type is host-header-rewrite.
Rewrites (list) --
The host header rewrite transform. Each transform consists of a regular expression to match and a replacement string.
(dict) --
Information about a rewrite transform. This transform matches a pattern and replaces it with the specified string.
Regex (string) --
The regular expression to match in the input string. The maximum length of the string is 1,024 characters.
Replace (string) --
The replacement string to use when rewriting the matched input. The maximum length of the string is 1,024 characters. You can specify capture groups in the regular expression (for example, $1 and $2).
UrlRewriteConfig (dict) --
Information about a URL rewrite transform. This transform modifies the request URL. Specify only when Type is url-rewrite.
Rewrites (list) --
The URL rewrite transform to apply to the request. The transform consists of a regular expression to match and a replacement string.
(dict) --
Information about a rewrite transform. This transform matches a pattern and replaces it with the specified string.
Regex (string) --
The regular expression to match in the input string. The maximum length of the string is 1,024 characters.
Replace (string) --
The replacement string to use when rewriting the matched input. The maximum length of the string is 1,024 characters. You can specify capture groups in the regular expression (for example, $1 and $2).
{'Rules': {'Actions': {'JwtValidationConfig': {'AdditionalClaims': [{'Format': 'single-string '
'| '
'string-array '
'| '
'space-separated-values',
'Name': 'string',
'Values': ['string']}],
'Issuer': 'string',
'JwksEndpoint': 'string'},
'Type': {'jwt-validation'}}}}
Sets the priorities of the specified rules.
You can reorder the rules as long as there are no priority conflicts in the new order. Any existing rules that you do not specify retain their current priority.
See also: AWS API Documentation
Request Syntax
client.set_rule_priorities(
RulePriorities=[
{
'RuleArn': 'string',
'Priority': 123
},
]
)
list
[REQUIRED]
The rule priorities.
(dict) --
Information about the priorities for the rules for a listener.
RuleArn (string) --
The Amazon Resource Name (ARN) of the rule.
Priority (integer) --
The rule priority.
dict
Response Syntax
{
'Rules': [
{
'RuleArn': 'string',
'Priority': 'string',
'Conditions': [
{
'Field': 'string',
'Values': [
'string',
],
'HostHeaderConfig': {
'Values': [
'string',
],
'RegexValues': [
'string',
]
},
'PathPatternConfig': {
'Values': [
'string',
],
'RegexValues': [
'string',
]
},
'HttpHeaderConfig': {
'HttpHeaderName': 'string',
'Values': [
'string',
],
'RegexValues': [
'string',
]
},
'QueryStringConfig': {
'Values': [
{
'Key': 'string',
'Value': 'string'
},
]
},
'HttpRequestMethodConfig': {
'Values': [
'string',
]
},
'SourceIpConfig': {
'Values': [
'string',
]
},
'RegexValues': [
'string',
]
},
],
'Actions': [
{
'Type': 'forward'|'authenticate-oidc'|'authenticate-cognito'|'redirect'|'fixed-response'|'jwt-validation',
'TargetGroupArn': 'string',
'AuthenticateOidcConfig': {
'Issuer': 'string',
'AuthorizationEndpoint': 'string',
'TokenEndpoint': 'string',
'UserInfoEndpoint': 'string',
'ClientId': 'string',
'ClientSecret': 'string',
'SessionCookieName': 'string',
'Scope': 'string',
'SessionTimeout': 123,
'AuthenticationRequestExtraParams': {
'string': 'string'
},
'OnUnauthenticatedRequest': 'deny'|'allow'|'authenticate',
'UseExistingClientSecret': True|False
},
'AuthenticateCognitoConfig': {
'UserPoolArn': 'string',
'UserPoolClientId': 'string',
'UserPoolDomain': 'string',
'SessionCookieName': 'string',
'Scope': 'string',
'SessionTimeout': 123,
'AuthenticationRequestExtraParams': {
'string': 'string'
},
'OnUnauthenticatedRequest': 'deny'|'allow'|'authenticate'
},
'Order': 123,
'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': 123
},
],
'TargetGroupStickinessConfig': {
'Enabled': True|False,
'DurationSeconds': 123
}
},
'JwtValidationConfig': {
'JwksEndpoint': 'string',
'Issuer': 'string',
'AdditionalClaims': [
{
'Format': 'single-string'|'string-array'|'space-separated-values',
'Name': 'string',
'Values': [
'string',
]
},
]
}
},
],
'IsDefault': True|False,
'Transforms': [
{
'Type': 'host-header-rewrite'|'url-rewrite',
'HostHeaderRewriteConfig': {
'Rewrites': [
{
'Regex': 'string',
'Replace': 'string'
},
]
},
'UrlRewriteConfig': {
'Rewrites': [
{
'Regex': 'string',
'Replace': 'string'
},
]
}
},
]
},
]
}
Response Structure
(dict) --
Rules (list) --
Information about the rules.
(dict) --
Information about a rule.
RuleArn (string) --
The Amazon Resource Name (ARN) of the rule.
Priority (string) --
The priority.
Conditions (list) --
The conditions. Each rule can include zero or one of the following conditions: http-request-method, host-header, path-pattern, and source-ip, and zero or more of the following conditions: http-header and query-string.
(dict) --
Information about a condition for a rule.
Each rule can optionally include up to one of each of the following conditions: http-request-method, host-header, path-pattern, and source-ip. Each rule can also optionally include one or more of each of the following conditions: http-header and query-string. Note that the value for a condition can't be empty.
For more information, see Quotas for your Application Load Balancers.
Field (string) --
The field in the HTTP request. The following are the possible values:
http-header
http-request-method
host-header
path-pattern
query-string
source-ip
Values (list) --
The condition value. Specify only when Field is host-header or path-pattern. Alternatively, to specify multiple host names or multiple path patterns, use HostHeaderConfig or PathPatternConfig.
If Field is host-header and you are not using HostHeaderConfig, you can specify a single host name (for example, my.example.com) in Values. A host name is case insensitive, can be up to 128 characters in length, and can contain any of the following characters.
A-Z, a-z, 0-9
.
(matches 0 or more characters)
? (matches exactly 1 character)
If Field is path-pattern and you are not using PathPatternConfig, you can specify a single path pattern (for example, /img/*) in Values. A path pattern is case-sensitive, can be up to 128 characters in length, and can contain any of the following characters.
A-Z, a-z, 0-9
_ - . $ / ~ " ' @ : +
& (using &)
(matches 0 or more characters)
? (matches exactly 1 character)
(string) --
HostHeaderConfig (dict) --
Information for a host header condition. Specify only when Field is host-header.
Values (list) --
The host names. The maximum length of each string is 128 characters. The comparison is case insensitive. The following wildcard characters are supported: * (matches 0 or more characters) and ? (matches exactly 1 character). You must include at least one "." character. You can include only alphabetical characters after the final "." character.
If you specify multiple strings, the condition is satisfied if one of the strings matches the host name.
(string) --
RegexValues (list) --
The regular expressions to compare against the host header. The maximum length of each string is 128 characters.
(string) --
PathPatternConfig (dict) --
Information for a path pattern condition. Specify only when Field is path-pattern.
Values (list) --
The path patterns to compare against the request URL. The maximum length of each string is 128 characters. The comparison is case sensitive. The following wildcard characters are supported: * (matches 0 or more characters) and ? (matches exactly 1 character).
If you specify multiple strings, the condition is satisfied if one of them matches the request URL. The path pattern is compared only to the path of the URL, not to its query string. To compare against the query string, use a query string condition.
(string) --
RegexValues (list) --
The regular expressions to compare against the request URL. The maximum length of each string is 128 characters.
(string) --
HttpHeaderConfig (dict) --
Information for an HTTP header condition. Specify only when Field is http-header.
HttpHeaderName (string) --
The name of the HTTP header field. The maximum length is 40 characters. The header name is case insensitive. The allowed characters are specified by RFC 7230. Wildcards are not supported.
You can't use an HTTP header condition to specify the host header. Instead, use a host condition.
Values (list) --
The strings to compare against the value of the HTTP header. The maximum length of each string is 128 characters. The comparison strings are case insensitive. The following wildcard characters are supported: * (matches 0 or more characters) and ? (matches exactly 1 character).
If the same header appears multiple times in the request, we search them in order until a match is found.
If you specify multiple strings, the condition is satisfied if one of the strings matches the value of the HTTP header. To require that all of the strings are a match, create one condition per string.
(string) --
RegexValues (list) --
The regular expression to compare against the HTTP header. The maximum length of each string is 128 characters.
(string) --
QueryStringConfig (dict) --
Information for a query string condition. Specify only when Field is query-string.
Values (list) --
The key/value pairs or values to find in the query string. The maximum length of each string is 128 characters. The comparison is case insensitive. The following wildcard characters are supported: * (matches 0 or more characters) and ? (matches exactly 1 character). To search for a literal '*' or '?' character in a query string, you must escape these characters in Values using a '' character.
If you specify multiple key/value pairs or values, the condition is satisfied if one of them is found in the query string.
(dict) --
Information about a key/value pair.
Key (string) --
The key. You can omit the key.
Value (string) --
The value.
HttpRequestMethodConfig (dict) --
Information for an HTTP method condition. Specify only when Field is http-request-method.
Values (list) --
The name of the request method. The maximum length is 40 characters. The allowed characters are A-Z, hyphen (-), and underscore (_). The comparison is case sensitive. Wildcards are not supported; therefore, the method name must be an exact match.
If you specify multiple strings, the condition is satisfied if one of the strings matches the HTTP request method. We recommend that you route GET and HEAD requests in the same way, because the response to a HEAD request may be cached.
(string) --
SourceIpConfig (dict) --
Information for a source IP condition. Specify only when Field is source-ip.
Values (list) --
The source IP addresses, in CIDR format. You can use both IPv4 and IPv6 addresses. Wildcards are not supported.
If you specify multiple addresses, the condition is satisfied if the source IP address of the request matches one of the CIDR blocks. This condition is not satisfied by the addresses in the X-Forwarded-For header. To search for addresses in the X-Forwarded-For header, use an HTTP header condition.
The total number of values must be less than, or equal to five.
(string) --
RegexValues (list) --
The regular expressions to match against the condition field. The maximum length of each string is 128 characters. Specify only when Field is http-header, host-header, or path-pattern.
(string) --
Actions (list) --
The actions. Each rule must include exactly one of the following types of actions: forward, redirect, or fixed-response, and it must be the last action to be performed.
(dict) --
Information about an action.
Each rule must include exactly one of the following routing actions: forward, fixed-response, or redirect, and it must be the last action to be performed.
Optionally, a rule for an HTTPS listener can also include one of the following user authentication actions: authenticate-oidc, authenticate-cognito, or jwt-validation.
Type (string) --
The type of action.
TargetGroupArn (string) --
The Amazon Resource Name (ARN) of the target group. Specify only when Type is forward and you want to route to a single target group. To route to multiple target groups, you must use ForwardConfig instead.
AuthenticateOidcConfig (dict) --
[HTTPS listeners] Information about an identity provider that is compliant with OpenID Connect (OIDC). Specify only when Type is authenticate-oidc.
Issuer (string) --
The OIDC issuer identifier of the IdP. This must be a full URL, including the HTTPS protocol, the domain, and the path.
AuthorizationEndpoint (string) --
The authorization endpoint of the IdP. This must be a full URL, including the HTTPS protocol, the domain, and the path.
TokenEndpoint (string) --
The token endpoint of the IdP. This must be a full URL, including the HTTPS protocol, the domain, and the path.
UserInfoEndpoint (string) --
The user info endpoint of the IdP. This must be a full URL, including the HTTPS protocol, the domain, and the path.
ClientId (string) --
The OAuth 2.0 client identifier.
ClientSecret (string) --
The OAuth 2.0 client secret. This parameter is required if you are creating a rule. If you are modifying a rule, you can omit this parameter if you set UseExistingClientSecret to true.
SessionCookieName (string) --
The name of the cookie used to maintain session information. The default is AWSELBAuthSessionCookie.
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 (integer) --
The maximum duration of the authentication session, in seconds. The default is 604800 seconds (7 days).
AuthenticationRequestExtraParams (dict) --
The query parameters (up to 10) to include in the redirect request to the authorization endpoint.
(string) --
(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) --
Indicates whether to use the existing client secret when modifying a rule. If you are creating a rule, you can omit this parameter or set it to false.
AuthenticateCognitoConfig (dict) --
[HTTPS listeners] Information for using Amazon Cognito to authenticate users. Specify only when Type is authenticate-cognito.
UserPoolArn (string) --
The Amazon Resource Name (ARN) of the Amazon Cognito user pool.
UserPoolClientId (string) --
The ID of the Amazon Cognito user pool client.
UserPoolDomain (string) --
The domain prefix or fully-qualified domain name of the Amazon Cognito user pool.
SessionCookieName (string) --
The name of the cookie used to maintain session information. The default is AWSELBAuthSessionCookie.
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 (integer) --
The maximum duration of the authentication session, in seconds. The default is 604800 seconds (7 days).
AuthenticationRequestExtraParams (dict) --
The query parameters (up to 10) to include in the redirect request to the authorization endpoint.
(string) --
(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) --
The order for the action. This value is required for rules with multiple actions. The action with the lowest value for order is performed first.
RedirectConfig (dict) --
[Application Load Balancer] Information for creating a redirect action. Specify only when Type is redirect.
Protocol (string) --
The protocol. You can specify HTTP, HTTPS, or #{protocol}. You can redirect HTTP to HTTP, HTTP to HTTPS, and HTTPS to HTTPS. You can't redirect HTTPS to HTTP.
Port (string) --
The port. You can specify a value from 1 to 65535 or #{port}.
Host (string) --
The hostname. This component is not percent-encoded. The hostname can contain #{host}.
Path (string) --
The absolute path, starting with the leading "/". This component is not percent-encoded. The path can contain #{host}, #{path}, and #{port}.
Query (string) --
The query parameters, URL-encoded when necessary, but not percent-encoded. Do not include the leading "?", as it is automatically added. You can specify any of the reserved keywords.
StatusCode (string) --
The HTTP redirect code. The redirect is either permanent (HTTP 301) or temporary (HTTP 302).
FixedResponseConfig (dict) --
[Application Load Balancer] Information for creating an action that returns a custom HTTP response. Specify only when Type is fixed-response.
MessageBody (string) --
The message.
StatusCode (string) --
The HTTP response code (2XX, 4XX, or 5XX).
ContentType (string) --
The content type.
Valid Values: text/plain | text/css | text/html | application/javascript | application/json
ForwardConfig (dict) --
Information for creating an action that distributes requests among multiple target groups. 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.
(dict) --
Information about how traffic will be distributed between multiple target groups in a forward rule.
TargetGroupArn (string) --
The Amazon Resource Name (ARN) of the target group.
Weight (integer) --
The weight. The range is 0 to 999.
TargetGroupStickinessConfig (dict) --
The target group stickiness for the rule.
Enabled (boolean) --
Indicates whether target group stickiness is enabled.
DurationSeconds (integer) --
[Application Load Balancers] The time period, in seconds, during which requests from a client should be routed to the same target group. The range is 1-604800 seconds (7 days). You must specify this value when enabling target group stickiness.
JwtValidationConfig (dict) --
[HTTPS listeners] Information for validating JWT access tokens in client requests. Specify only when Type is jwt-validation.
JwksEndpoint (string) --
The JSON Web Key Set (JWKS) endpoint. This endpoint contains JSON Web Keys (JWK) that are used to validate signatures from the provider.
This must be a full URL, including the HTTPS protocol, the domain, and the path. The maximum length is 256 characters.
Issuer (string) --
The issuer of the JWT. The maximum length is 256 characters.
AdditionalClaims (list) --
Additional claims to validate. The maximum size of the list is 10. We validate the exp, iss, nbf, and iat claims by default.
(dict) --
Information about an additional claim to validate.
Format (string) --
The format of the claim value.
Name (string) --
The name of the claim. You can't specify exp, iss, nbf, or iat because we validate them by default.
Values (list) --
The claim value. The maximum size of the list is 10. Each value can be up to 256 characters in length. If the format is space-separated-values, the values can't include spaces.
(string) --
IsDefault (boolean) --
Indicates whether this is the default rule.
Transforms (list) --
The transforms for the rule.
(dict) --
Information about a transform to apply to requests that match a rule. Transforms are applied to requests before they are sent to targets.
Type (string) --
The type of transform.
host-header-rewrite - Rewrite the host header.
url-rewrite - Rewrite the request URL.
HostHeaderRewriteConfig (dict) --
Information about a host header rewrite transform. This transform modifies the host header in an HTTP request. Specify only when Type is host-header-rewrite.
Rewrites (list) --
The host header rewrite transform. Each transform consists of a regular expression to match and a replacement string.
(dict) --
Information about a rewrite transform. This transform matches a pattern and replaces it with the specified string.
Regex (string) --
The regular expression to match in the input string. The maximum length of the string is 1,024 characters.
Replace (string) --
The replacement string to use when rewriting the matched input. The maximum length of the string is 1,024 characters. You can specify capture groups in the regular expression (for example, $1 and $2).
UrlRewriteConfig (dict) --
Information about a URL rewrite transform. This transform modifies the request URL. Specify only when Type is url-rewrite.
Rewrites (list) --
The URL rewrite transform to apply to the request. The transform consists of a regular expression to match and a replacement string.
(dict) --
Information about a rewrite transform. This transform matches a pattern and replaces it with the specified string.
Regex (string) --
The regular expression to match in the input string. The maximum length of the string is 1,024 characters.
Replace (string) --
The replacement string to use when rewriting the matched input. The maximum length of the string is 1,024 characters. You can specify capture groups in the regular expression (for example, $1 and $2).