AWS WAF Security Automations has used lambda to sovle this.
ConfigureAWSWAFLogs:
Type: 'Custom::ConfigureAWSWAFLogs'
Condition: HttpFloodProtectionLogParserActivated
Properties:
ServiceToken: !GetAtt CustomResource.Arn
WAFWebACLArn: !GetAtt WebACLStack.Outputs.WAFWebACLArn
DeliveryStreamArn: !GetAtt FirehoseAthenaStack.Outputs.FirehoseWAFLogsDeliveryStreamArn
CustomResource lambda funtion
elif event['ResourceType'] == "Custom::ConfigureAWSWAFLogs":
if 'CREATE' in request_type:
put_logging_configuration(log, event['ResourceProperties']['WAFWebACLArn'],
event['ResourceProperties']['DeliveryStreamArn'])
check it out at https://github.com/awslabs/aws-waf-security-automations
amazon-wafaws-waf-security-automations