Skip to content

Commit add5b47

Browse files
authored
feat: enable VPC Flow Logs with CloudWatch and KMS encryption (#194)
1 parent 14a9493 commit add5b47

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,10 @@ Lambda functions live in `src/<lambda-name>/` directories with an `index.mjs` (o
176176
## checkov
177177
[Checkov]() is an amazing tool to lint terraform (and other) resources, we use the non-official pre-commit hook by antonbabenko
178178

179+
## VPC Flow Logs
180+
181+
VPC Flow Logs capture network traffic metadata for security analysis, troubleshooting, and compliance. Example 05 enables flow logs using the VPC module's built-in support, sending logs to CloudWatch Logs with KMS encryption and 90-day retention. See `examples/05-aws-complete/networking.tf`.
182+
179183
## State Locking
180184
We use S3 native locking with `use_lockfile = true` (requires Terraform 1.6+). This eliminates the need for a separate DynamoDB table for state locking.
181185

examples/05-aws-complete/networking.tf

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,14 @@ module "vpc" {
1616
database_subnets = var.subnets.database
1717
create_database_subnet_group = true
1818
enable_dns_hostnames = true
19+
20+
enable_flow_log = true
21+
create_flow_log_cloudwatch_log_group = true
22+
create_flow_log_cloudwatch_iam_role = true
23+
flow_log_max_aggregation_interval = 60
24+
flow_log_cloudwatch_log_group_name_prefix = "/aws/vpc-flow-logs/"
25+
flow_log_cloudwatch_log_group_retention_in_days = 90
26+
flow_log_cloudwatch_log_group_kms_key_id = aws_kms_key.main.arn
1927
}
2028

2129
# Specific security group for all VPC endpoints

0 commit comments

Comments
 (0)