ELB access logging disabled

Collect and protect access logs needed to investigate Classic ELB requests.

Description

Classic Load Balancer access logs record requests at the load balancer, including client details and errors that may never reach the application.

Potential impact

Missing records make unusual traffic and service failures harder to investigate.

Remediation

Set AccessLoggingPolicy.Enabled to true and supply an S3 bucket in the load balancer’s Region. Use SSE-S3, allow log delivery in the bucket policy, and restrict readers and retention. After test traffic, confirm that a request log arrives in S3.

Examples

Supply the HTTPS listener certificate (SSLCertificateId). The sample Availability Zone, us-east-2a, assumes a default VPC. In a nondefault VPC, specify Subnets instead of AvailabilityZones.

Before

yaml
Resources:
  MyLoadBalancer:
    Type: AWS::ElasticLoadBalancing::LoadBalancer
    Properties:
      AvailabilityZones:
        - us-east-2a
      Listeners:
        - InstancePort: "80"
          LoadBalancerPort: "443"
          Protocol: HTTPS

After

yaml
Resources:
  MyLoadBalancer:
    Type: AWS::ElasticLoadBalancing::LoadBalancer
    Properties:
      AvailabilityZones:
        - us-east-2a
      Listeners:
        - InstancePort: "80"
          LoadBalancerPort: "443"
          Protocol: HTTPS
      AccessLoggingPolicy:
        Enabled: true
        S3BucketName: my-elb-access-logs

Replace my-elb-access-logs with the prepared bucket name.

References