AWS WAF Integration Guide
AWS WAF INTEGRATION
Implementation Guide
1. Prerequisites
Ensure the following conditions are met before beginning the implementation:
An active AWS account with permissions to manage waf, S3, SQS and IAM.
AWS Management Console access.
The target S3 bucket region must match the WAF region.
IAM administrator access or the ability to create IAM roles and attach policies.
2. Enable AWS WAF Logging
AWS WAF logging must be explicitly enabled on each Web ACL. WAF does not log by default.
2.1 Via AWS Console
Navigate to AWS WAF & Shield in the AWS Console
Select Web ACLs from the left navigation pane

Choose your Web ACL and click the Logging and metrics tab
Click Enable logging

Select <CentralizedS3Bucket> as the logging destination.
Click Save to activate logging
2.2 Create S3 Bucket
The S3 bucket serves as the primary log archive destination. The bucket must be created in the same region as the WAF.
Procedure
Sign in to the AWS Management Console and navigate to the S3 service.
Verify that the selected region matches the region of your WAF.
Click Create bucket.
Enter the bucket name: <bucket-name>
Leave all other settings at their defaults.
Click Create bucket to confirm.
2.3 Create SQS Queue
Procedure
Navigate to Amazon SQS in the same region as the S3 bucket.
Click Create queue.
Select Standard queue type.
Enter any queue name, for example aws-waf-logs-queue
Configure the following queue attributes:
Visibility timeout: 15 minutes
Receive message wait time: 20 seconds
Under Access policy, click Advanced and replace the default policy with the following:
NOTE: Replace and with your actual AWS region and 12-digit account ID before applying this policy.
Click Create queue.
2.4 Configure S3 Event Notifications
Procedure
Navigate to the S3 service and select the bucket created
Click the Properties tab.
Scroll to the Event notifications section and click Create event notification.
Configure the following settings:
Event notification name: enter a descriptive name (e.g., waf-logs-put-event)
Prefix: awswaflogs
Event types: select PUT
Destination: select SQS queue and choose aws-waf-logs-queue
Click Save changes.

2.5 Verify S3 Object Delivery
Navigate to the S3 bucket: aws-waf-logs-dev
Browse to the prefix: awswaflogs/year=YYYY/month=MM/day=DD/hour=HH/
Confirm that compressed log files with extension .json.gz are present.
2.6 Verify SQS Notifications
Navigate to Amazon SQS and select the queue: aws-waf-logs-queue
Click Send and receive messages.
Click Poll for messages and confirm that messages are present, indicating that S3 events are being delivered to the queue.
Each message body should contain JSON with the s3.object.key of the newly created log file.
Last updated