如何使用Cloudformation在AWS WAF中启用WebACL的日志记录?

时间:2019-10-24 15:25:22

标签: amazon-web-services amazon-cloudformation amazon-waf

我正在查看AWS WAF Cloudformation文档,但找不到启用日志记录的方法。我可以通过控制台启用日志记录,但是我想通过Cloudformation进行日志记录,以便默认情况下在新堆栈中将其启用。

如何通过Cloudformation启用登录AWS WAF WebACL。

谢谢

3 个答案:

答案 0 :(得分:2)

目前不支持。可能因为这个原因:

If you are capturing logs for Amazon CloudFront, create the firehose in US East (N. Virginia)

这意味着该堆栈需要在多个区域中创建资源。

您可以在CloudFormation路线图页面here

上对问题进行跟踪并投票。

答案 1 :(得分:1)

目前尚不可用,但是可以在创建新的Web ACL时使用AWS Config设置日志记录。

答案 2 :(得分:0)

AWS WAF 安全自动化已使用 lambda 来解决此问题。

   ConfigureAWSWAFLogs:
    Type: 'Custom::ConfigureAWSWAFLogs'
    Condition: HttpFloodProtectionLogParserActivated
    Properties:
      ServiceToken: !GetAtt CustomResource.Arn
      WAFWebACLArn: !GetAtt WebACLStack.Outputs.WAFWebACLArn
      DeliveryStreamArn: !GetAtt FirehoseAthenaStack.Outputs.FirehoseWAFLogsDeliveryStreamArn

CustomResource lambda 函数

elif event['ResourceType'] == "Custom::ConfigureAWSWAFLogs":
            if 'CREATE' in request_type:
                put_logging_configuration(log, event['ResourceProperties']['WAFWebACLArn'],
                                          event['ResourceProperties']['DeliveryStreamArn'])

https://github.com/awslabs/aws-waf-security-automations 处查看

相关问题