def check_requirements()

in templates/aws-cloudfront-waf/source/helper/helper.py [0:0]


def check_requirements(log, resource_properties):
    log.debug("[check_requirements] Start")

    # ------------------------------------------------------------------------------------------------------------------
    # Logging Web ACL Traffic for CloudFront distribution
    # ------------------------------------------------------------------------------------------------------------------
    if (resource_properties['HttpFloodProtectionLogParserActivated'] == "yes" and
            resource_properties['EndpointType'].lower() == 'cloudfront' and
            resource_properties['Region'] != 'us-east-1'):
        raise Exception(
            "If you are capturing AWS WAF logs for a Amazon CloudFront distribution, create the stack in US East (N. Virginia). More info: https://amzn.to/2F5L1Ae")

    # ------------------------------------------------------------------------------------------------------------------
    # Logging Web ACL Traffic for CloudFront distribution
    # ------------------------------------------------------------------------------------------------------------------
    if (resource_properties['HttpFloodProtectionRateBasedRuleActivated'] == "yes" and
            int(resource_properties['RequestThreshold']) < 100):
        raise Exception(
            "The minimum rate-based rule rate limit per 5 minute period is 100. If need to use values below that, please select AWS Lambda or Amazon Athena log parser.")

    log.debug("[check_requirements] End")