Elastic Load Balancing

2019/03/27 - Elastic Load Balancing - 4 updated api methods

Changes  This release adds support for routing based on HTTP headers, methods, query string or query parameters and source IP addresses in Application Load Balancer.

CreateRule (updated) Link ¶
Changes (request, response)
Request
{'Conditions': {'HostHeaderConfig': {'Values': ['string']},
                'HttpHeaderConfig': {'HttpHeaderName': 'string',
                                     'Values': ['string']},
                'HttpRequestMethodConfig': {'Values': ['string']},
                'PathPatternConfig': {'Values': ['string']},
                'QueryStringConfig': {'Values': [{'Key': 'string',
                                                  'Value': 'string'}]},
                'SourceIpConfig': {'Values': ['string']}}}
Response
{'Rules': {'Conditions': {'HostHeaderConfig': {'Values': ['string']},
                          'HttpHeaderConfig': {'HttpHeaderName': 'string',
                                               'Values': ['string']},
                          'HttpRequestMethodConfig': {'Values': ['string']},
                          'PathPatternConfig': {'Values': ['string']},
                          'QueryStringConfig': {'Values': [{'Key': 'string',
                                                            'Value': 'string'}]},
                          'SourceIpConfig': {'Values': ['string']}}}}

Creates a rule for the specified listener. The listener must be associated with an Application Load Balancer.

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'
            }
        },
    ]
)
type ListenerArn

string

param ListenerArn

[REQUIRED]

The Amazon Resource Name (ARN) of the listener.

type Conditions

list

param Conditions

[REQUIRED]

The conditions. Each condition specifies a field name and a single value.

If the field name is host-header , you can specify a single host name (for example, my.example.com). A host name is case insensitive, can be up to 128 characters in length, and can contain any of the following characters. You can include up to three wildcard characters.

  • A-Z, a-z, 0-9

    • .

    • (matches 0 or more characters)

  • ? (matches exactly 1 character)

If the field name is path-pattern , you can specify a single path pattern. A path pattern is case-sensitive, can be up to 128 characters in length, and can contain any of the following characters. You can include up to three wildcard characters.

  • A-Z, a-z, 0-9

  • _ - . $ / ~ " ' @ : +

  • & (using &)

    • (matches 0 or more characters)

  • ? (matches exactly 1 character)

  • (dict) --

    Information about a condition for a rule.

    • Field (string) --

      The name of the field. The possible values are host-header and path-pattern .

    • Values (list) --

      The condition value.

      If the field name is host-header , you can specify a single host name (for example, my.example.com). A host name is case insensitive, can be up to 128 characters in length, and can contain any of the following characters. You can include up to three wildcard characters.

      • A-Z, a-z, 0-9

        • .

        • (matches 0 or more characters)

      • ? (matches exactly 1 character)

      If the field name is path-pattern , you can specify a single path pattern (for example, /img/*). A path pattern is case-sensitive, can be up to 128 characters in length, and can contain any of the following characters. You can include up to three wildcard characters.

      • A-Z, a-z, 0-9

      • _ - . $ / ~ " ' @ : +

      • & (using &)

        • (matches 0 or more characters)

      • ? (matches exactly 1 character)

      • (string) --

    • HostHeaderConfig (dict) --

      • Values (list) --

        • (string) --

    • PathPatternConfig (dict) --

      • Values (list) --

        • (string) --

    • HttpHeaderConfig (dict) --

      • HttpHeaderName (string) --

      • Values (list) --

        • (string) --

    • QueryStringConfig (dict) --

      • Values (list) --

        • (dict) --

          • Key (string) --

          • Value (string) --

    • HttpRequestMethodConfig (dict) --

      • Values (list) --

        • (string) --

    • SourceIpConfig (dict) --

      • Values (list) --

        • (string) --

type Priority

integer

param Priority

[REQUIRED]

The rule priority. A listener can't have multiple rules with the same priority.

type Actions

list

param Actions

[REQUIRED]

The actions. Each rule must include exactly one of the following types of actions: forward , fixed-response , or redirect .

If the action type is forward , you specify a target group. 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 or TLS 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.

    • Type (string) -- [REQUIRED]

      The type of action. Each rule must include exactly one of the following types of actions: forward , fixed-response , or redirect .

    • TargetGroupArn (string) --

      The Amazon Resource Name (ARN) of the target group. Specify only when Type is forward .

    • 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. The final action to be performed must be a forward or a fixed-response action.

    • 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

rtype

dict

returns

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'
                    }
                },
            ],
            '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.

          • (dict) --

            Information about a condition for a rule.

            • Field (string) --

              The name of the field. The possible values are host-header and path-pattern .

            • Values (list) --

              The condition value.

              If the field name is host-header , you can specify a single host name (for example, my.example.com). A host name is case insensitive, can be up to 128 characters in length, and can contain any of the following characters. You can include up to three wildcard characters.

              • A-Z, a-z, 0-9

                • .

                • (matches 0 or more characters)

              • ? (matches exactly 1 character)

              If the field name is path-pattern , you can specify a single path pattern (for example, /img/*). A path pattern is case-sensitive, can be up to 128 characters in length, and can contain any of the following characters. You can include up to three wildcard characters.

              • A-Z, a-z, 0-9

              • _ - . $ / ~ " ' @ : +

              • & (using &)

                • (matches 0 or more characters)

              • ? (matches exactly 1 character)

              • (string) --

            • HostHeaderConfig (dict) --

              • Values (list) --

                • (string) --

            • PathPatternConfig (dict) --

              • Values (list) --

                • (string) --

            • HttpHeaderConfig (dict) --

              • HttpHeaderName (string) --

              • Values (list) --

                • (string) --

            • QueryStringConfig (dict) --

              • Values (list) --

                • (dict) --

                  • Key (string) --

                  • Value (string) --

            • HttpRequestMethodConfig (dict) --

              • Values (list) --

                • (string) --

            • SourceIpConfig (dict) --

              • Values (list) --

                • (string) --

        • Actions (list) --

          The actions.

          • (dict) --

            Information about an action.

            • Type (string) --

              The type of action. Each rule must include exactly one of the following types of actions: forward , fixed-response , or redirect .

            • TargetGroupArn (string) --

              The Amazon Resource Name (ARN) of the target group. Specify only when Type is forward .

            • 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. The final action to be performed must be a forward or a fixed-response action.

            • 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

        • IsDefault (boolean) --

          Indicates whether this is the default rule.

DescribeRules (updated) Link ¶
Changes (response)
{'Rules': {'Conditions': {'HostHeaderConfig': {'Values': ['string']},
                          'HttpHeaderConfig': {'HttpHeaderName': 'string',
                                               'Values': ['string']},
                          'HttpRequestMethodConfig': {'Values': ['string']},
                          'PathPatternConfig': {'Values': ['string']},
                          'QueryStringConfig': {'Values': [{'Key': 'string',
                                                            'Value': 'string'}]},
                          'SourceIpConfig': {'Values': ['string']}}}}

Describes the specified rules or the rules for the specified listener. You must specify either a listener or one or more rules.

See also: AWS API Documentation

Request Syntax

client.describe_rules(
    ListenerArn='string',
    RuleArns=[
        'string',
    ],
    Marker='string',
    PageSize=123
)
type ListenerArn

string

param ListenerArn

The Amazon Resource Name (ARN) of the listener.

type RuleArns

list

param RuleArns

The Amazon Resource Names (ARN) of the rules.

  • (string) --

type Marker

string

param Marker

The marker for the next set of results. (You received this marker from a previous call.)

type PageSize

integer

param PageSize

The maximum number of results to return with this call.

rtype

dict

returns

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'
                    }
                },
            ],
            'IsDefault': True|False
        },
    ],
    '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.

          • (dict) --

            Information about a condition for a rule.

            • Field (string) --

              The name of the field. The possible values are host-header and path-pattern .

            • Values (list) --

              The condition value.

              If the field name is host-header , you can specify a single host name (for example, my.example.com). A host name is case insensitive, can be up to 128 characters in length, and can contain any of the following characters. You can include up to three wildcard characters.

              • A-Z, a-z, 0-9

                • .

                • (matches 0 or more characters)

              • ? (matches exactly 1 character)

              If the field name is path-pattern , you can specify a single path pattern (for example, /img/*). A path pattern is case-sensitive, can be up to 128 characters in length, and can contain any of the following characters. You can include up to three wildcard characters.

              • A-Z, a-z, 0-9

              • _ - . $ / ~ " ' @ : +

              • & (using &)

                • (matches 0 or more characters)

              • ? (matches exactly 1 character)

              • (string) --

            • HostHeaderConfig (dict) --

              • Values (list) --

                • (string) --

            • PathPatternConfig (dict) --

              • Values (list) --

                • (string) --

            • HttpHeaderConfig (dict) --

              • HttpHeaderName (string) --

              • Values (list) --

                • (string) --

            • QueryStringConfig (dict) --

              • Values (list) --

                • (dict) --

                  • Key (string) --

                  • Value (string) --

            • HttpRequestMethodConfig (dict) --

              • Values (list) --

                • (string) --

            • SourceIpConfig (dict) --

              • Values (list) --

                • (string) --

        • Actions (list) --

          The actions.

          • (dict) --

            Information about an action.

            • Type (string) --

              The type of action. Each rule must include exactly one of the following types of actions: forward , fixed-response , or redirect .

            • TargetGroupArn (string) --

              The Amazon Resource Name (ARN) of the target group. Specify only when Type is forward .

            • 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. The final action to be performed must be a forward or a fixed-response action.

            • 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

        • IsDefault (boolean) --

          Indicates whether this is the default rule.

    • NextMarker (string) --

      The marker to use when requesting the next set of results. If there are no additional results, the string is empty.

ModifyRule (updated) Link ¶
Changes (request, response)
Request
{'Conditions': {'HostHeaderConfig': {'Values': ['string']},
                'HttpHeaderConfig': {'HttpHeaderName': 'string',
                                     'Values': ['string']},
                'HttpRequestMethodConfig': {'Values': ['string']},
                'PathPatternConfig': {'Values': ['string']},
                'QueryStringConfig': {'Values': [{'Key': 'string',
                                                  'Value': 'string'}]},
                'SourceIpConfig': {'Values': ['string']}}}
Response
{'Rules': {'Conditions': {'HostHeaderConfig': {'Values': ['string']},
                          'HttpHeaderConfig': {'HttpHeaderName': 'string',
                                               'Values': ['string']},
                          'HttpRequestMethodConfig': {'Values': ['string']},
                          'PathPatternConfig': {'Values': ['string']},
                          'QueryStringConfig': {'Values': [{'Key': 'string',
                                                            'Value': 'string'}]},
                          'SourceIpConfig': {'Values': ['string']}}}}

Modifies the specified rule.

Any existing properties that you do not modify retain their current values.

To modify the actions for the default rule, use ModifyListener.

See also: AWS API Documentation

Request Syntax

client.modify_rule(
    RuleArn='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'
            }
        },
    ]
)
type RuleArn

string

param RuleArn

[REQUIRED]

The Amazon Resource Name (ARN) of the rule.

type Conditions

list

param Conditions

The conditions. Each condition specifies a field name and a single value.

If the field name is host-header , you can specify a single host name (for example, my.example.com). A host name is case insensitive, can be up to 128 characters in length, and can contain any of the following characters. You can include up to three wildcard characters.

  • A-Z, a-z, 0-9

    • .

    • (matches 0 or more characters)

  • ? (matches exactly 1 character)

If the field name is path-pattern , you can specify a single path pattern. A path pattern is case-sensitive, can be up to 128 characters in length, and can contain any of the following characters. You can include up to three wildcard characters.

  • A-Z, a-z, 0-9

  • _ - . $ / ~ " ' @ : +

  • & (using &)

    • (matches 0 or more characters)

  • ? (matches exactly 1 character)

  • (dict) --

    Information about a condition for a rule.

    • Field (string) --

      The name of the field. The possible values are host-header and path-pattern .

    • Values (list) --

      The condition value.

      If the field name is host-header , you can specify a single host name (for example, my.example.com). A host name is case insensitive, can be up to 128 characters in length, and can contain any of the following characters. You can include up to three wildcard characters.

      • A-Z, a-z, 0-9

        • .

        • (matches 0 or more characters)

      • ? (matches exactly 1 character)

      If the field name is path-pattern , you can specify a single path pattern (for example, /img/*). A path pattern is case-sensitive, can be up to 128 characters in length, and can contain any of the following characters. You can include up to three wildcard characters.

      • A-Z, a-z, 0-9

      • _ - . $ / ~ " ' @ : +

      • & (using &)

        • (matches 0 or more characters)

      • ? (matches exactly 1 character)

      • (string) --

    • HostHeaderConfig (dict) --

      • Values (list) --

        • (string) --

    • PathPatternConfig (dict) --

      • Values (list) --

        • (string) --

    • HttpHeaderConfig (dict) --

      • HttpHeaderName (string) --

      • Values (list) --

        • (string) --

    • QueryStringConfig (dict) --

      • Values (list) --

        • (dict) --

          • Key (string) --

          • Value (string) --

    • HttpRequestMethodConfig (dict) --

      • Values (list) --

        • (string) --

    • SourceIpConfig (dict) --

      • Values (list) --

        • (string) --

type Actions

list

param Actions

The actions.

If the action type is forward , you specify a target group. 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 or TLS 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.

    • Type (string) -- [REQUIRED]

      The type of action. Each rule must include exactly one of the following types of actions: forward , fixed-response , or redirect .

    • TargetGroupArn (string) --

      The Amazon Resource Name (ARN) of the target group. Specify only when Type is forward .

    • 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. The final action to be performed must be a forward or a fixed-response action.

    • 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

rtype

dict

returns

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'
                    }
                },
            ],
            'IsDefault': True|False
        },
    ]
}

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.

          • (dict) --

            Information about a condition for a rule.

            • Field (string) --

              The name of the field. The possible values are host-header and path-pattern .

            • Values (list) --

              The condition value.

              If the field name is host-header , you can specify a single host name (for example, my.example.com). A host name is case insensitive, can be up to 128 characters in length, and can contain any of the following characters. You can include up to three wildcard characters.

              • A-Z, a-z, 0-9

                • .

                • (matches 0 or more characters)

              • ? (matches exactly 1 character)

              If the field name is path-pattern , you can specify a single path pattern (for example, /img/*). A path pattern is case-sensitive, can be up to 128 characters in length, and can contain any of the following characters. You can include up to three wildcard characters.

              • A-Z, a-z, 0-9

              • _ - . $ / ~ " ' @ : +

              • & (using &)

                • (matches 0 or more characters)

              • ? (matches exactly 1 character)

              • (string) --

            • HostHeaderConfig (dict) --

              • Values (list) --

                • (string) --

            • PathPatternConfig (dict) --

              • Values (list) --

                • (string) --

            • HttpHeaderConfig (dict) --

              • HttpHeaderName (string) --

              • Values (list) --

                • (string) --

            • QueryStringConfig (dict) --

              • Values (list) --

                • (dict) --

                  • Key (string) --

                  • Value (string) --

            • HttpRequestMethodConfig (dict) --

              • Values (list) --

                • (string) --

            • SourceIpConfig (dict) --

              • Values (list) --

                • (string) --

        • Actions (list) --

          The actions.

          • (dict) --

            Information about an action.

            • Type (string) --

              The type of action. Each rule must include exactly one of the following types of actions: forward , fixed-response , or redirect .

            • TargetGroupArn (string) --

              The Amazon Resource Name (ARN) of the target group. Specify only when Type is forward .

            • 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. The final action to be performed must be a forward or a fixed-response action.

            • 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

        • IsDefault (boolean) --

          Indicates whether this is the default rule.

SetRulePriorities (updated) Link ¶
Changes (response)
{'Rules': {'Conditions': {'HostHeaderConfig': {'Values': ['string']},
                          'HttpHeaderConfig': {'HttpHeaderName': 'string',
                                               'Values': ['string']},
                          'HttpRequestMethodConfig': {'Values': ['string']},
                          'PathPatternConfig': {'Values': ['string']},
                          'QueryStringConfig': {'Values': [{'Key': 'string',
                                                            'Value': 'string'}]},
                          'SourceIpConfig': {'Values': ['string']}}}}

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
        },
    ]
)
type RulePriorities

list

param RulePriorities

[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.

rtype

dict

returns

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'
                    }
                },
            ],
            'IsDefault': True|False
        },
    ]
}

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.

          • (dict) --

            Information about a condition for a rule.

            • Field (string) --

              The name of the field. The possible values are host-header and path-pattern .

            • Values (list) --

              The condition value.

              If the field name is host-header , you can specify a single host name (for example, my.example.com). A host name is case insensitive, can be up to 128 characters in length, and can contain any of the following characters. You can include up to three wildcard characters.

              • A-Z, a-z, 0-9

                • .

                • (matches 0 or more characters)

              • ? (matches exactly 1 character)

              If the field name is path-pattern , you can specify a single path pattern (for example, /img/*). A path pattern is case-sensitive, can be up to 128 characters in length, and can contain any of the following characters. You can include up to three wildcard characters.

              • A-Z, a-z, 0-9

              • _ - . $ / ~ " ' @ : +

              • & (using &)

                • (matches 0 or more characters)

              • ? (matches exactly 1 character)

              • (string) --

            • HostHeaderConfig (dict) --

              • Values (list) --

                • (string) --

            • PathPatternConfig (dict) --

              • Values (list) --

                • (string) --

            • HttpHeaderConfig (dict) --

              • HttpHeaderName (string) --

              • Values (list) --

                • (string) --

            • QueryStringConfig (dict) --

              • Values (list) --

                • (dict) --

                  • Key (string) --

                  • Value (string) --

            • HttpRequestMethodConfig (dict) --

              • Values (list) --

                • (string) --

            • SourceIpConfig (dict) --

              • Values (list) --

                • (string) --

        • Actions (list) --

          The actions.

          • (dict) --

            Information about an action.

            • Type (string) --

              The type of action. Each rule must include exactly one of the following types of actions: forward , fixed-response , or redirect .

            • TargetGroupArn (string) --

              The Amazon Resource Name (ARN) of the target group. Specify only when Type is forward .

            • 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. The final action to be performed must be a forward or a fixed-response action.

            • 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

        • IsDefault (boolean) --

          Indicates whether this is the default rule.