VPC Flow Logs and Athena Query Pack
Enables VPC flow logs to S3 and creates an Athena table for querying them. Includes 10 security queries: port scanners, unusual protocols, rejected traffic analysis.
VPC Flow Logs and Athena Query Pack
VPC flow logs are your network audit trail, but they are useless sitting in S3 without a way to query them. This package sets up the full pipeline — flow logs to S3 with Hive partitioning, an Athena table, a Glue crawler for automatic partition discovery, and 10 ready-to-run security queries.
Infrastructure Deployed
- VPC Flow Logs — enabled on all VPCs via Lambda custom resource, publishing to S3 in Parquet format with Hive partitioning (
year/month/day/hour) for efficient querying - S3 Bucket — dedicated flow logs bucket with lifecycle rules (90-day intelligent tiering, 365-day expiry) and server-side encryption
- Glue Database + Crawler — crawler runs hourly to register new partitions, keeping the Athena table current without manual partition maintenance
- Athena Workgroup — dedicated workgroup with per-query data scanned limits to prevent runaway costs
Included Security Queries
- Top talkers by bytes transferred
- Rejected traffic by destination port (firewall gap analysis)
- Port scan detection (source IPs hitting 20+ destination ports)
- Unusual protocol traffic (non-TCP/UDP/ICMP)
- Inter-AZ data transfer analysis
- SSH/RDP brute force attempts
- Traffic to/from known bad IP ranges
- Outbound traffic on non-standard ports
- Short-lived connections (potential C2 beaconing)
- Daily traffic volume anomalies
What You Get
vpc-flow-logs.yaml— CloudFormation templatequeries/— 10 named Athena queries as.sqlfilessaved-queries-import.sh— registers queries in the Athena consoleREADME.md— cost estimates, query usage guide, and adding custom queries