2020/10/02 - Elastic Load Balancing - 3 updated api methods
Changes This release adds support for tagging listeners, rules, and target groups on creation. This release also supported tagging operations through tagging api's for listeners and rules.
{'Tags': [{'Key': 'string', 'Value': 'string'}]}
Creates a listener for the specified Application Load Balancer or Network Load Balancer.
To update a listener, use ModifyListener . When you are finished with a listener, you can delete it using DeleteListener . If you are finished with both the listener and the load balancer, you can delete them both using DeleteLoadBalancer .
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.
For more information, see Listeners for Your Application Load Balancers in the Application Load Balancers Guide and Listeners for Your Network Load Balancers in the Network Load Balancers Guide .
See also: AWS API Documentation
Request Syntax
client.create_listener( LoadBalancerArn='string', Protocol='HTTP'|'HTTPS'|'TCP'|'TLS'|'UDP'|'TCP_UDP', Port=123, SslPolicy='string', Certificates=[ { 'CertificateArn': 'string', 'IsDefault': True|False }, ], DefaultActions=[ { 'Type': 'forward'|'authenticate-oidc'|'authenticate-cognito'|'redirect'|'fixed-response', 'TargetGroupArn': 'string', 'AuthenticateOidcConfig': { 'Issuer': 'string', 'AuthorizationEndpoint': 'string', 'TokenEndpoint': 'string', 'UserInfoEndpoint': 'string', 'ClientId': 'string', 'ClientSecret': 'string', 'SessionCookieName': 'string', 'Scope': 'string', 'SessionTimeout': 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 } } }, ], AlpnPolicy=[ 'string', ], Tags=[ { 'Key': 'string', 'Value': 'string' }, ] )
string
[REQUIRED]
The Amazon Resource Name (ARN) of the load balancer.
string
[REQUIRED]
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.
integer
[REQUIRED]
The port on which the load balancer is listening.
string
[HTTPS and TLS listeners] The security policy that defines which protocols and ciphers are supported. The following are the possible values:
ELBSecurityPolicy-2016-08
ELBSecurityPolicy-TLS-1-0-2015-04
ELBSecurityPolicy-TLS-1-1-2017-01
ELBSecurityPolicy-TLS-1-2-2017-01
ELBSecurityPolicy-TLS-1-2-Ext-2018-06
ELBSecurityPolicy-FS-2018-06
ELBSecurityPolicy-FS-1-1-2019-08
ELBSecurityPolicy-FS-1-2-2019-08
ELBSecurityPolicy-FS-1-2-Res-2019-08
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 .
To create a certificate list for the listener, use AddListenerCertificates .
(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. The rule must include one forward action or one or more fixed-response actions.
If the action type is forward , you specify one or more target groups. The protocol of the target group must be HTTP or HTTPS for an Application Load Balancer. The protocol of the target group must be TCP, TLS, UDP, or TCP_UDP for a Network Load Balancer.
[HTTPS listeners] If the action type is authenticate-oidc , you authenticate users through an identity provider that is OpenID Connect (OIDC) compliant.
[HTTPS listeners] If the action type is authenticate-cognito , you authenticate users through the user pools supported by Amazon Cognito.
[Application Load Balancer] If the action type is redirect , you redirect specified client requests from one URL to another.
[Application Load Balancer] If the action type is fixed-response , you drop specified client requests and return a custom HTTP response.
(dict) --
Information about an action.
Each rule must include exactly one of the following types of actions: forward , fixed-response , or redirect , and it must be the last action to be performed.
Type (string) -- [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 one or more target groups, 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 cannot 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 one or more target groups. For Network Load Balancers, you can specify a single target group. Specify only when Type is forward . If you specify both ForwardConfig and TargetGroupArn , you can specify only one target group using ForwardConfig and it must be the same target group specified in TargetGroupArn .
TargetGroups (list) --
One or more target groups. For Network Load Balancers, you can specify a single target group.
(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) --
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).
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
Response Syntax
{ 'Listeners': [ { 'ListenerArn': 'string', 'LoadBalancerArn': 'string', 'Port': 123, 'Protocol': 'HTTP'|'HTTPS'|'TCP'|'TLS'|'UDP'|'TCP_UDP', 'Certificates': [ { 'CertificateArn': 'string', 'IsDefault': True|False }, ], 'SslPolicy': 'string', 'DefaultActions': [ { 'Type': 'forward'|'authenticate-oidc'|'authenticate-cognito'|'redirect'|'fixed-response', 'TargetGroupArn': 'string', 'AuthenticateOidcConfig': { 'Issuer': 'string', 'AuthorizationEndpoint': 'string', 'TokenEndpoint': 'string', 'UserInfoEndpoint': 'string', 'ClientId': 'string', 'ClientSecret': 'string', 'SessionCookieName': 'string', 'Scope': 'string', 'SessionTimeout': 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 } } }, ], 'AlpnPolicy': [ 'string', ] }, ] }
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 types of actions: forward , fixed-response , or redirect , and it must be the last action to be performed.
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 one or more target groups, 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 cannot 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 one or more target groups. For Network Load Balancers, you can specify a single target group. Specify only when Type is forward . If you specify both ForwardConfig and TargetGroupArn , you can specify only one target group using ForwardConfig and it must be the same target group specified in TargetGroupArn .
TargetGroups (list) --
One or more target groups. For Network Load Balancers, you can specify a single target group.
(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) --
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).
AlpnPolicy (list) --
[TLS listener] The name of the Application-Layer Protocol Negotiation (ALPN) policy.
(string) --
{'Tags': [{'Key': 'string', 'Value': 'string'}]}
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, and one or more conditions. 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 .
To view your current rules, use DescribeRules . To update a rule, use ModifyRule . To set the priorities of your rules, use SetRulePriorities . To delete a rule, use DeleteRule .
See also: AWS API Documentation
Request Syntax
client.create_rule( ListenerArn='string', Conditions=[ { 'Field': 'string', 'Values': [ 'string', ], 'HostHeaderConfig': { 'Values': [ 'string', ] }, 'PathPatternConfig': { 'Values': [ 'string', ] }, 'HttpHeaderConfig': { 'HttpHeaderName': 'string', 'Values': [ 'string', ] }, 'QueryStringConfig': { 'Values': [ { 'Key': 'string', 'Value': 'string' }, ] }, 'HttpRequestMethodConfig': { 'Values': [ 'string', ] }, 'SourceIpConfig': { 'Values': [ 'string', ] } }, ], Priority=123, Actions=[ { 'Type': 'forward'|'authenticate-oidc'|'authenticate-cognito'|'redirect'|'fixed-response', 'TargetGroupArn': 'string', 'AuthenticateOidcConfig': { 'Issuer': 'string', 'AuthorizationEndpoint': 'string', 'TokenEndpoint': 'string', 'UserInfoEndpoint': 'string', 'ClientId': 'string', 'ClientSecret': 'string', 'SessionCookieName': 'string', 'Scope': 'string', 'SessionTimeout': 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 } } }, ], Tags=[ { 'Key': 'string', 'Value': 'string' }, ] )
string
[REQUIRED]
The Amazon Resource Name (ARN) of the listener.
list
[REQUIRED]
The conditions. 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 .
(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 .
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) --
One or more host names. The maximum size of each name is 128 characters. The comparison is case insensitive. 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 the strings matches the host name.
(string) --
PathPatternConfig (dict) --
Information for a path pattern condition. Specify only when Field is path-pattern .
Values (list) --
One or more path patterns to compare against the request URL. The maximum size 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 QueryStringConditionConfig .
(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 size 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. Use HostHeaderConditionConfig to specify a host header condition.
Values (list) --
One or more strings to compare against the value of the HTTP header. The maximum size 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) --
QueryStringConfig (dict) --
Information for a query string condition. Specify only when Field is query-string .
Values (list) --
One or more key/value pairs or values to find in the query string. The maximum size 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 size 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) --
One or more 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 HttpHeaderConditionConfig .
(string) --
integer
[REQUIRED]
The rule priority. A listener can't have multiple rules with the same priority.
list
[REQUIRED]
The actions. Each rule must include exactly one of the following types of actions: forward , fixed-response , or redirect , and it must be the last action to be performed.
If the action type is forward , you specify one or more target groups. The protocol of the target group must be HTTP or HTTPS for an Application Load Balancer. The protocol of the target group must be TCP, TLS, UDP, or TCP_UDP for a Network Load Balancer.
[HTTPS listeners] If the action type is authenticate-oidc , you authenticate users through an identity provider that is OpenID Connect (OIDC) compliant.
[HTTPS listeners] If the action type is authenticate-cognito , you authenticate users through the user pools supported by Amazon Cognito.
[Application Load Balancer] If the action type is redirect , you redirect specified client requests from one URL to another.
[Application Load Balancer] If the action type is fixed-response , you drop specified client requests and return a custom HTTP response.
(dict) --
Information about an action.
Each rule must include exactly one of the following types of actions: forward , fixed-response , or redirect , and it must be the last action to be performed.
Type (string) -- [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 one or more target groups, 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 cannot 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 one or more target groups. For Network Load Balancers, you can specify a single target group. Specify only when Type is forward . If you specify both ForwardConfig and TargetGroupArn , you can specify only one target group using ForwardConfig and it must be the same target group specified in TargetGroupArn .
TargetGroups (list) --
One or more target groups. For Network Load Balancers, you can specify a single target group.
(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) --
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).
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.
dict
Response Syntax
{ 'Rules': [ { 'RuleArn': 'string', 'Priority': 'string', 'Conditions': [ { 'Field': 'string', 'Values': [ 'string', ], 'HostHeaderConfig': { 'Values': [ 'string', ] }, 'PathPatternConfig': { 'Values': [ 'string', ] }, 'HttpHeaderConfig': { 'HttpHeaderName': 'string', 'Values': [ 'string', ] }, 'QueryStringConfig': { 'Values': [ { 'Key': 'string', 'Value': 'string' }, ] }, 'HttpRequestMethodConfig': { 'Values': [ 'string', ] }, 'SourceIpConfig': { 'Values': [ 'string', ] } }, ], 'Actions': [ { 'Type': 'forward'|'authenticate-oidc'|'authenticate-cognito'|'redirect'|'fixed-response', 'TargetGroupArn': 'string', 'AuthenticateOidcConfig': { 'Issuer': 'string', 'AuthorizationEndpoint': 'string', 'TokenEndpoint': 'string', 'UserInfoEndpoint': 'string', 'ClientId': 'string', 'ClientSecret': 'string', 'SessionCookieName': 'string', 'Scope': 'string', 'SessionTimeout': 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 } } }, ], 'IsDefault': True|False }, ] }
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 .
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) --
One or more host names. The maximum size of each name is 128 characters. The comparison is case insensitive. 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 the strings matches the host name.
(string) --
PathPatternConfig (dict) --
Information for a path pattern condition. Specify only when Field is path-pattern .
Values (list) --
One or more path patterns to compare against the request URL. The maximum size 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 QueryStringConditionConfig .
(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 size 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. Use HostHeaderConditionConfig to specify a host header condition.
Values (list) --
One or more strings to compare against the value of the HTTP header. The maximum size 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) --
QueryStringConfig (dict) --
Information for a query string condition. Specify only when Field is query-string .
Values (list) --
One or more key/value pairs or values to find in the query string. The maximum size 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 size 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) --
One or more 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 HttpHeaderConditionConfig .
(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 types of actions: forward , fixed-response , or redirect , and it must be the last action to be performed.
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 one or more target groups, 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 cannot 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 one or more target groups. For Network Load Balancers, you can specify a single target group. Specify only when Type is forward . If you specify both ForwardConfig and TargetGroupArn , you can specify only one target group using ForwardConfig and it must be the same target group specified in TargetGroupArn .
TargetGroups (list) --
One or more target groups. For Network Load Balancers, you can specify a single target group.
(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) --
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).
IsDefault (boolean) --
Indicates whether this is the default rule.
{'Tags': [{'Key': 'string', 'Value': 'string'}]}
Creates a target group.
To register targets with the target group, use RegisterTargets . To update the health check settings for the target group, use ModifyTargetGroup . To monitor the health of targets in the target group, use DescribeTargetHealth .
To route traffic to the targets in a target group, specify the target group in an action using CreateListener or CreateRule .
To delete a target group, use DeleteTargetGroup .
This operation is idempotent, which means that it completes at most one time. If you attempt to create multiple target groups with the same settings, each call succeeds.
For more information, see Target Groups for Your Application Load Balancers in the Application Load Balancers Guide or Target Groups for Your Network Load Balancers in the Network Load Balancers Guide .
See also: AWS API Documentation
Request Syntax
client.create_target_group( Name='string', Protocol='HTTP'|'HTTPS'|'TCP'|'TLS'|'UDP'|'TCP_UDP', Port=123, VpcId='string', HealthCheckProtocol='HTTP'|'HTTPS'|'TCP'|'TLS'|'UDP'|'TCP_UDP', HealthCheckPort='string', HealthCheckEnabled=True|False, HealthCheckPath='string', HealthCheckIntervalSeconds=123, HealthCheckTimeoutSeconds=123, HealthyThresholdCount=123, UnhealthyThresholdCount=123, Matcher={ 'HttpCode': 'string' }, TargetType='instance'|'ip'|'lambda', Tags=[ { 'Key': 'string', 'Value': 'string' }, ] )
string
[REQUIRED]
The name of the target group.
This name must be unique per region per account, can have a maximum of 32 characters, must contain only alphanumeric characters or hyphens, and must not begin or end with a hyphen.
string
The protocol to use for routing traffic to the targets. For Application Load Balancers, the supported protocols are HTTP and HTTPS. For Network Load Balancers, the supported protocols are TCP, TLS, UDP, or TCP_UDP. A TCP_UDP listener must be associated with a TCP_UDP target group. If the target is a Lambda function, this parameter does not apply.
integer
The port on which the targets receive traffic. This port is used unless you specify a port override when registering the target. If the target is a Lambda function, this parameter does not apply.
string
The identifier of the virtual private cloud (VPC). If the target is a Lambda function, this parameter does not apply. Otherwise, this parameter is required.
string
The protocol the load balancer uses when performing health checks on targets. For Application Load Balancers, the default is HTTP. For Network Load Balancers, the default is TCP. The TCP protocol is supported for health checks only if the protocol of the target group is TCP, TLS, UDP, or TCP_UDP. The TLS, UDP, and TCP_UDP protocols are not supported for health checks.
string
The port the load balancer uses when performing health checks on targets. The default is traffic-port , which is the port on which each target receives traffic from the load balancer.
boolean
Indicates whether health checks are enabled. If the target type is lambda , health checks are disabled by default but can be enabled. If the target type is instance or ip , health checks are always enabled and cannot be disabled.
string
[HTTP/HTTPS health checks] The ping path that is the destination on the targets for health checks. The default is /.
integer
The approximate amount of time, in seconds, between health checks of an individual target. For HTTP and HTTPS health checks, the range is 5–300 seconds. For TCP health checks, the supported values are 10 and 30 seconds. If the target type is instance or ip , the default is 30 seconds. If the target type is lambda , the default is 35 seconds.
integer
The amount of time, in seconds, during which no response from a target means a failed health check. For target groups with a protocol of HTTP or HTTPS, the default is 5 seconds. For target groups with a protocol of TCP or TLS, this value must be 6 seconds for HTTP health checks and 10 seconds for TCP and HTTPS health checks. If the target type is lambda , the default is 30 seconds.
integer
The number of consecutive health checks successes required before considering an unhealthy target healthy. For target groups with a protocol of HTTP or HTTPS, the default is 5. For target groups with a protocol of TCP or TLS, the default is 3. If the target type is lambda , the default is 5.
integer
The number of consecutive health check failures required before considering a target unhealthy. For target groups with a protocol of HTTP or HTTPS, the default is 2. For target groups with a protocol of TCP or TLS, this value must be the same as the healthy threshold count. If the target type is lambda , the default is 2.
dict
[HTTP/HTTPS health checks] The HTTP codes to use when checking for a successful response from a target.
HttpCode (string) -- [REQUIRED]
The HTTP codes.
For Application Load Balancers, you can specify values between 200 and 499, and the default value is 200. You can specify multiple values (for example, "200,202") or a range of values (for example, "200-299").
For Network Load Balancers, this is 200–399.
string
The type of target that you must specify when registering targets with this target group. You can't specify targets for a target group using more than one target type.
instance - Targets are specified by instance ID. This is the default value.
ip - Targets are specified by IP address. You can specify IP addresses from the subnets of the virtual private cloud (VPC) for the target group, the RFC 1918 range (10.0.0.0/8, 172.16.0.0/12, and 192.168.0.0/16), and the RFC 6598 range (100.64.0.0/10). You can't specify publicly routable IP addresses.
lambda - The target groups contains a single Lambda function.
list
The tags to assign to the target group.
(dict) --
Information about a tag.
Key (string) -- [REQUIRED]
The key of the tag.
Value (string) --
The value of the tag.
dict
Response Syntax
{ 'TargetGroups': [ { 'TargetGroupArn': 'string', 'TargetGroupName': 'string', 'Protocol': 'HTTP'|'HTTPS'|'TCP'|'TLS'|'UDP'|'TCP_UDP', 'Port': 123, 'VpcId': 'string', 'HealthCheckProtocol': 'HTTP'|'HTTPS'|'TCP'|'TLS'|'UDP'|'TCP_UDP', 'HealthCheckPort': 'string', 'HealthCheckEnabled': True|False, 'HealthCheckIntervalSeconds': 123, 'HealthCheckTimeoutSeconds': 123, 'HealthyThresholdCount': 123, 'UnhealthyThresholdCount': 123, 'HealthCheckPath': 'string', 'Matcher': { 'HttpCode': 'string' }, 'LoadBalancerArns': [ 'string', ], 'TargetType': 'instance'|'ip'|'lambda' }, ] }
Response Structure
(dict) --
TargetGroups (list) --
Information about the target group.
(dict) --
Information about a target group.
TargetGroupArn (string) --
The Amazon Resource Name (ARN) of the target group.
TargetGroupName (string) --
The name of the target group.
Protocol (string) --
The protocol to use for routing traffic to the targets.
Port (integer) --
The port on which the targets are listening. Not used if the target is a Lambda function.
VpcId (string) --
The ID of the VPC for the targets.
HealthCheckProtocol (string) --
The protocol to use to connect with the target.
HealthCheckPort (string) --
The port to use to connect with the target.
HealthCheckEnabled (boolean) --
Indicates whether health checks are enabled.
HealthCheckIntervalSeconds (integer) --
The approximate amount of time, in seconds, between health checks of an individual target.
HealthCheckTimeoutSeconds (integer) --
The amount of time, in seconds, during which no response means a failed health check.
HealthyThresholdCount (integer) --
The number of consecutive health checks successes required before considering an unhealthy target healthy.
UnhealthyThresholdCount (integer) --
The number of consecutive health check failures required before considering the target unhealthy.
HealthCheckPath (string) --
The destination for the health check request.
Matcher (dict) --
The HTTP codes to use when checking for a successful response from a target.
HttpCode (string) --
The HTTP codes.
For Application Load Balancers, you can specify values between 200 and 499, and the default value is 200. You can specify multiple values (for example, "200,202") or a range of values (for example, "200-299").
For Network Load Balancers, this is 200–399.
LoadBalancerArns (list) --
The Amazon Resource Names (ARN) of the load balancers that route traffic to this target group.
(string) --
TargetType (string) --
The type of target that you must specify when registering targets with this target group. The possible values are instance (targets are specified by instance ID) or ip (targets are specified by IP address).