Enable access logging for ALB from cloudformation

Viewed 2562

I want to enable access logging for my application load balancer and here I found the process of how to:

But I wanted to implement the same thing via cloudformation and found that access logging can be enabled via cloudformation only for the classic load balancer

Is there any way to implement the same for the ALB [elb v2]

1 Answers

Yes. You enable them using AWS::ElasticLoadBalancingV2::LoadBalancer Load Balancer Attribute for both NLB and ALB.

access_logs.s3.enabled - Indicates whether access logs are enabled. The value is true or false. The default is false.

access_logs.s3.bucket - The name of the S3 bucket for the access logs. This attribute is required if access logs are enabled. The bucket must exist in the same region as the load balancer and have a bucket policy that grants Elastic Load Balancing permissions to write to the bucket.

access_logs.s3.prefix - The prefix for the location in the S3 bucket for the access logs.

Related