AWS WAFV2

2020/07/31 - AWS WAFV2 - 3 updated api methods

Changes  Add ManagedByFirewallManager flag to the logging configuration, which indicates whether AWS Firewall Manager controls the configuration.

GetLoggingConfiguration (updated) Link ¶
Changes (response)
{'LoggingConfiguration': {'ManagedByFirewallManager': 'boolean'}}

Note

This is the latest version of AWS WAF , named AWS WAFV2, released in November, 2019. For information, including how to migrate your AWS WAF resources from the prior release, see the AWS WAF Developer Guide.

Returns the LoggingConfiguration for the specified web ACL.

See also: AWS API Documentation

Request Syntax

client.get_logging_configuration(
    ResourceArn='string'
)
type ResourceArn

string

param ResourceArn

[REQUIRED]

The Amazon Resource Name (ARN) of the web ACL for which you want to get the LoggingConfiguration.

rtype

dict

returns

Response Syntax

{
    'LoggingConfiguration': {
        'ResourceArn': 'string',
        'LogDestinationConfigs': [
            'string',
        ],
        'RedactedFields': [
            {
                'SingleHeader': {
                    'Name': 'string'
                },
                'SingleQueryArgument': {
                    'Name': 'string'
                },
                'AllQueryArguments': {},
                'UriPath': {},
                'QueryString': {},
                'Body': {},
                'Method': {}
            },
        ],
        'ManagedByFirewallManager': True|False
    }
}

Response Structure

  • (dict) --

    • LoggingConfiguration (dict) --

      The LoggingConfiguration for the specified web ACL.

      • ResourceArn (string) --

        The Amazon Resource Name (ARN) of the web ACL that you want to associate with LogDestinationConfigs .

      • LogDestinationConfigs (list) --

        The Amazon Kinesis Data Firehose Amazon Resource Name (ARNs) that you want to associate with the web ACL.

        • (string) --

      • RedactedFields (list) --

        The parts of the request that you want to keep out of the logs. For example, if you redact the HEADER field, the HEADER field in the firehose will be xxx .

        Note

        You must use one of the following values: URI , QUERY_STRING , HEADER , or METHOD .

        • (dict) --

          Note

          This is the latest version of AWS WAF , named AWS WAFV2, released in November, 2019. For information, including how to migrate your AWS WAF resources from the prior release, see the AWS WAF Developer Guide.

          The part of a web request that you want AWS WAF to inspect. Include the single FieldToMatch type that you want to inspect, with additional specifications as needed, according to the type. You specify a single request component in FieldToMatch for each rule statement that requires it. To inspect more than one component of a web request, create a separate rule statement for each component.

          • SingleHeader (dict) --

            Inspect a single header. Provide the name of the header to inspect, for example, User-Agent or Referer . This setting isn't case sensitive.

            • Name (string) --

              The name of the query header to inspect.

          • SingleQueryArgument (dict) --

            Inspect a single query argument. Provide the name of the query argument to inspect, such as UserName or SalesRegion . The name can be up to 30 characters long and isn't case sensitive.

            This is used only to indicate the web request component for AWS WAF to inspect, in the FieldToMatch specification.

            • Name (string) --

              The name of the query argument to inspect.

          • AllQueryArguments (dict) --

            Inspect all query arguments.

          • UriPath (dict) --

            Inspect the request URI path. This is the part of a web request that identifies a resource, for example, /images/daily-ad.jpg .

          • QueryString (dict) --

            Inspect the query string. This is the part of a URL that appears after a ? character, if any.

          • Body (dict) --

            Inspect the request body, which immediately follows the request headers. This is the part of a request that contains any additional data that you want to send to your web server as the HTTP request body, such as data from a form.

            Note that only the first 8 KB (8192 bytes) of the request body are forwarded to AWS WAF for inspection by the underlying host service. If you don't need to inspect more than 8 KB, you can guarantee that you don't allow additional bytes in by combining a statement that inspects the body of the web request, such as ByteMatchStatement or RegexPatternSetReferenceStatement, with a SizeConstraintStatement that enforces an 8 KB size limit on the body of the request. AWS WAF doesn't support inspecting the entire contents of web requests whose bodies exceed the 8 KB limit.

          • Method (dict) --

            Inspect the HTTP method. The method indicates the type of operation that the request is asking the origin to perform.

      • ManagedByFirewallManager (boolean) --

        Indicates whether the logging configuration was created by AWS Firewall Manager, as part of an AWS WAF policy configuration. If true, only Firewall Manager can modify or delete the configuration.

ListLoggingConfigurations (updated) Link ¶
Changes (response)
{'LoggingConfigurations': {'ManagedByFirewallManager': 'boolean'}}

Note

This is the latest version of AWS WAF , named AWS WAFV2, released in November, 2019. For information, including how to migrate your AWS WAF resources from the prior release, see the AWS WAF Developer Guide.

Retrieves an array of your LoggingConfiguration objects.

See also: AWS API Documentation

Request Syntax

client.list_logging_configurations(
    Scope='CLOUDFRONT'|'REGIONAL',
    NextMarker='string',
    Limit=123
)
type Scope

string

param Scope

Specifies whether this is for an AWS CloudFront distribution or for a regional application. A regional application can be an Application Load Balancer (ALB) or an API Gateway stage.

To work with CloudFront, you must also specify the Region US East (N. Virginia) as follows:

  • CLI - Specify the Region when you use the CloudFront scope: --scope=CLOUDFRONT --region=us-east-1 .

  • API and SDKs - For all calls, use the Region endpoint us-east-1.

type NextMarker

string

param NextMarker

When you request a list of objects with a Limit setting, if the number of objects that are still available for retrieval exceeds the limit, AWS WAF returns a NextMarker value in the response. To retrieve the next batch of objects, provide the marker from the prior call in your next request.

type Limit

integer

param Limit

The maximum number of objects that you want AWS WAF to return for this request. If more objects are available, in the response, AWS WAF provides a NextMarker value that you can use in a subsequent call to get the next batch of objects.

rtype

dict

returns

Response Syntax

{
    'LoggingConfigurations': [
        {
            'ResourceArn': 'string',
            'LogDestinationConfigs': [
                'string',
            ],
            'RedactedFields': [
                {
                    'SingleHeader': {
                        'Name': 'string'
                    },
                    'SingleQueryArgument': {
                        'Name': 'string'
                    },
                    'AllQueryArguments': {},
                    'UriPath': {},
                    'QueryString': {},
                    'Body': {},
                    'Method': {}
                },
            ],
            'ManagedByFirewallManager': True|False
        },
    ],
    'NextMarker': 'string'
}

Response Structure

  • (dict) --

    • LoggingConfigurations (list) --

      • (dict) --

        Note

        This is the latest version of AWS WAF , named AWS WAFV2, released in November, 2019. For information, including how to migrate your AWS WAF resources from the prior release, see the AWS WAF Developer Guide.

        Defines an association between Amazon Kinesis Data Firehose destinations and a web ACL resource, for logging from AWS WAF. As part of the association, you can specify parts of the standard logging fields to keep out of the logs.

        • ResourceArn (string) --

          The Amazon Resource Name (ARN) of the web ACL that you want to associate with LogDestinationConfigs .

        • LogDestinationConfigs (list) --

          The Amazon Kinesis Data Firehose Amazon Resource Name (ARNs) that you want to associate with the web ACL.

          • (string) --

        • RedactedFields (list) --

          The parts of the request that you want to keep out of the logs. For example, if you redact the HEADER field, the HEADER field in the firehose will be xxx .

          Note

          You must use one of the following values: URI , QUERY_STRING , HEADER , or METHOD .

          • (dict) --

            Note

            This is the latest version of AWS WAF , named AWS WAFV2, released in November, 2019. For information, including how to migrate your AWS WAF resources from the prior release, see the AWS WAF Developer Guide.

            The part of a web request that you want AWS WAF to inspect. Include the single FieldToMatch type that you want to inspect, with additional specifications as needed, according to the type. You specify a single request component in FieldToMatch for each rule statement that requires it. To inspect more than one component of a web request, create a separate rule statement for each component.

            • SingleHeader (dict) --

              Inspect a single header. Provide the name of the header to inspect, for example, User-Agent or Referer . This setting isn't case sensitive.

              • Name (string) --

                The name of the query header to inspect.

            • SingleQueryArgument (dict) --

              Inspect a single query argument. Provide the name of the query argument to inspect, such as UserName or SalesRegion . The name can be up to 30 characters long and isn't case sensitive.

              This is used only to indicate the web request component for AWS WAF to inspect, in the FieldToMatch specification.

              • Name (string) --

                The name of the query argument to inspect.

            • AllQueryArguments (dict) --

              Inspect all query arguments.

            • UriPath (dict) --

              Inspect the request URI path. This is the part of a web request that identifies a resource, for example, /images/daily-ad.jpg .

            • QueryString (dict) --

              Inspect the query string. This is the part of a URL that appears after a ? character, if any.

            • Body (dict) --

              Inspect the request body, which immediately follows the request headers. This is the part of a request that contains any additional data that you want to send to your web server as the HTTP request body, such as data from a form.

              Note that only the first 8 KB (8192 bytes) of the request body are forwarded to AWS WAF for inspection by the underlying host service. If you don't need to inspect more than 8 KB, you can guarantee that you don't allow additional bytes in by combining a statement that inspects the body of the web request, such as ByteMatchStatement or RegexPatternSetReferenceStatement, with a SizeConstraintStatement that enforces an 8 KB size limit on the body of the request. AWS WAF doesn't support inspecting the entire contents of web requests whose bodies exceed the 8 KB limit.

            • Method (dict) --

              Inspect the HTTP method. The method indicates the type of operation that the request is asking the origin to perform.

        • ManagedByFirewallManager (boolean) --

          Indicates whether the logging configuration was created by AWS Firewall Manager, as part of an AWS WAF policy configuration. If true, only Firewall Manager can modify or delete the configuration.

    • NextMarker (string) --

      When you request a list of objects with a Limit setting, if the number of objects that are still available for retrieval exceeds the limit, AWS WAF returns a NextMarker value in the response. To retrieve the next batch of objects, provide the marker from the prior call in your next request.

PutLoggingConfiguration (updated) Link ¶
Changes (both)
{'LoggingConfiguration': {'ManagedByFirewallManager': 'boolean'}}

Note

This is the latest version of AWS WAF , named AWS WAFV2, released in November, 2019. For information, including how to migrate your AWS WAF resources from the prior release, see the AWS WAF Developer Guide.

Enables the specified LoggingConfiguration, to start logging from a web ACL, according to the configuration provided.

You can access information about all traffic that AWS WAF inspects using the following steps:

  • Create an Amazon Kinesis Data Firehose. Create the data firehose with a PUT source and in the Region that you are operating. If you are capturing logs for Amazon CloudFront, always create the firehose in US East (N. Virginia). Give the data firehose a name that starts with the prefix aws-waf-logs- . For example, aws-waf-logs-us-east-2-analytics .

Note

Do not create the data firehose using a Kinesis stream as your source.

  • Associate that firehose to your web ACL using a PutLoggingConfiguration request.

When you successfully enable logging using a PutLoggingConfiguration request, AWS WAF will create a service linked role with the necessary permissions to write logs to the Amazon Kinesis Data Firehose. For more information, see Logging Web ACL Traffic Information in the AWS WAF Developer Guide .

See also: AWS API Documentation

Request Syntax

client.put_logging_configuration(
    LoggingConfiguration={
        'ResourceArn': 'string',
        'LogDestinationConfigs': [
            'string',
        ],
        'RedactedFields': [
            {
                'SingleHeader': {
                    'Name': 'string'
                },
                'SingleQueryArgument': {
                    'Name': 'string'
                },
                'AllQueryArguments': {}
                ,
                'UriPath': {}
                ,
                'QueryString': {}
                ,
                'Body': {}
                ,
                'Method': {}

            },
        ],
        'ManagedByFirewallManager': True|False
    }
)
type LoggingConfiguration

dict

param LoggingConfiguration

[REQUIRED]

  • ResourceArn (string) -- [REQUIRED]

    The Amazon Resource Name (ARN) of the web ACL that you want to associate with LogDestinationConfigs .

  • LogDestinationConfigs (list) -- [REQUIRED]

    The Amazon Kinesis Data Firehose Amazon Resource Name (ARNs) that you want to associate with the web ACL.

    • (string) --

  • RedactedFields (list) --

    The parts of the request that you want to keep out of the logs. For example, if you redact the HEADER field, the HEADER field in the firehose will be xxx .

    Note

    You must use one of the following values: URI , QUERY_STRING , HEADER , or METHOD .

    • (dict) --

      Note

      This is the latest version of AWS WAF , named AWS WAFV2, released in November, 2019. For information, including how to migrate your AWS WAF resources from the prior release, see the AWS WAF Developer Guide.

      The part of a web request that you want AWS WAF to inspect. Include the single FieldToMatch type that you want to inspect, with additional specifications as needed, according to the type. You specify a single request component in FieldToMatch for each rule statement that requires it. To inspect more than one component of a web request, create a separate rule statement for each component.

      • SingleHeader (dict) --

        Inspect a single header. Provide the name of the header to inspect, for example, User-Agent or Referer . This setting isn't case sensitive.

        • Name (string) -- [REQUIRED]

          The name of the query header to inspect.

      • SingleQueryArgument (dict) --

        Inspect a single query argument. Provide the name of the query argument to inspect, such as UserName or SalesRegion . The name can be up to 30 characters long and isn't case sensitive.

        This is used only to indicate the web request component for AWS WAF to inspect, in the FieldToMatch specification.

        • Name (string) -- [REQUIRED]

          The name of the query argument to inspect.

      • AllQueryArguments (dict) --

        Inspect all query arguments.

      • UriPath (dict) --

        Inspect the request URI path. This is the part of a web request that identifies a resource, for example, /images/daily-ad.jpg .

      • QueryString (dict) --

        Inspect the query string. This is the part of a URL that appears after a ? character, if any.

      • Body (dict) --

        Inspect the request body, which immediately follows the request headers. This is the part of a request that contains any additional data that you want to send to your web server as the HTTP request body, such as data from a form.

        Note that only the first 8 KB (8192 bytes) of the request body are forwarded to AWS WAF for inspection by the underlying host service. If you don't need to inspect more than 8 KB, you can guarantee that you don't allow additional bytes in by combining a statement that inspects the body of the web request, such as ByteMatchStatement or RegexPatternSetReferenceStatement, with a SizeConstraintStatement that enforces an 8 KB size limit on the body of the request. AWS WAF doesn't support inspecting the entire contents of web requests whose bodies exceed the 8 KB limit.

      • Method (dict) --

        Inspect the HTTP method. The method indicates the type of operation that the request is asking the origin to perform.

  • ManagedByFirewallManager (boolean) --

    Indicates whether the logging configuration was created by AWS Firewall Manager, as part of an AWS WAF policy configuration. If true, only Firewall Manager can modify or delete the configuration.

rtype

dict

returns

Response Syntax

{
    'LoggingConfiguration': {
        'ResourceArn': 'string',
        'LogDestinationConfigs': [
            'string',
        ],
        'RedactedFields': [
            {
                'SingleHeader': {
                    'Name': 'string'
                },
                'SingleQueryArgument': {
                    'Name': 'string'
                },
                'AllQueryArguments': {},
                'UriPath': {},
                'QueryString': {},
                'Body': {},
                'Method': {}
            },
        ],
        'ManagedByFirewallManager': True|False
    }
}

Response Structure

  • (dict) --

    • LoggingConfiguration (dict) --

      • ResourceArn (string) --

        The Amazon Resource Name (ARN) of the web ACL that you want to associate with LogDestinationConfigs .

      • LogDestinationConfigs (list) --

        The Amazon Kinesis Data Firehose Amazon Resource Name (ARNs) that you want to associate with the web ACL.

        • (string) --

      • RedactedFields (list) --

        The parts of the request that you want to keep out of the logs. For example, if you redact the HEADER field, the HEADER field in the firehose will be xxx .

        Note

        You must use one of the following values: URI , QUERY_STRING , HEADER , or METHOD .

        • (dict) --

          Note

          This is the latest version of AWS WAF , named AWS WAFV2, released in November, 2019. For information, including how to migrate your AWS WAF resources from the prior release, see the AWS WAF Developer Guide.

          The part of a web request that you want AWS WAF to inspect. Include the single FieldToMatch type that you want to inspect, with additional specifications as needed, according to the type. You specify a single request component in FieldToMatch for each rule statement that requires it. To inspect more than one component of a web request, create a separate rule statement for each component.

          • SingleHeader (dict) --

            Inspect a single header. Provide the name of the header to inspect, for example, User-Agent or Referer . This setting isn't case sensitive.

            • Name (string) --

              The name of the query header to inspect.

          • SingleQueryArgument (dict) --

            Inspect a single query argument. Provide the name of the query argument to inspect, such as UserName or SalesRegion . The name can be up to 30 characters long and isn't case sensitive.

            This is used only to indicate the web request component for AWS WAF to inspect, in the FieldToMatch specification.

            • Name (string) --

              The name of the query argument to inspect.

          • AllQueryArguments (dict) --

            Inspect all query arguments.

          • UriPath (dict) --

            Inspect the request URI path. This is the part of a web request that identifies a resource, for example, /images/daily-ad.jpg .

          • QueryString (dict) --

            Inspect the query string. This is the part of a URL that appears after a ? character, if any.

          • Body (dict) --

            Inspect the request body, which immediately follows the request headers. This is the part of a request that contains any additional data that you want to send to your web server as the HTTP request body, such as data from a form.

            Note that only the first 8 KB (8192 bytes) of the request body are forwarded to AWS WAF for inspection by the underlying host service. If you don't need to inspect more than 8 KB, you can guarantee that you don't allow additional bytes in by combining a statement that inspects the body of the web request, such as ByteMatchStatement or RegexPatternSetReferenceStatement, with a SizeConstraintStatement that enforces an 8 KB size limit on the body of the request. AWS WAF doesn't support inspecting the entire contents of web requests whose bodies exceed the 8 KB limit.

          • Method (dict) --

            Inspect the HTTP method. The method indicates the type of operation that the request is asking the origin to perform.

      • ManagedByFirewallManager (boolean) --

        Indicates whether the logging configuration was created by AWS Firewall Manager, as part of an AWS WAF policy configuration. If true, only Firewall Manager can modify or delete the configuration.