Description
Classic ELB access logs record incoming requests and responses at the load balancer.
Potential impact
Missing request records make client errors and unusual traffic harder to trace.
Remediation
Set enabled = true in access_logs. Allow log delivery to an SSE-S3 bucket in the same Region, restrict access and set retention. Send test traffic and check the configured prefix after a delivery interval.
Examples
The example sets bucket_prefix = "bar" and a 60-minute interval in both configurations. Supply the listener and bucket policy separately.
Before
hcl
resource "aws_elb" "example" {
name = "foobar-terraform-elb"
availability_zones = ["us-west-2a", "us-west-2b", "us-west-2c"]
access_logs {
bucket = "foo"
bucket_prefix = "bar"
interval = 60
enabled = false
}
}
After
hcl
resource "aws_elb" "example" {
name = "foobar-terraform-elb"
availability_zones = ["us-west-2a", "us-west-2b", "us-west-2c"]
access_logs {
bucket = "foo"
bucket_prefix = "bar"
interval = 60
enabled = true
}
}