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]
After you enable and configure this feature for an Elastic Load Balancer, log files will be delivered to the Amazon S3 bucket of your choice. The log files contain information about each HTTP and TCP request processed by the load balancer.
You can view logs, such as /var/log/cloud-init. log or /var/log/cfn-init. log , to help you debug the instance launch. You can retrieve the logs by logging in to your instance, but you must disable rollback on failure or else AWS CloudFormation deletes the instance after your stack fails to create.
First, navigate to the EC2 Dashboard > Load Balancers > Select your ALB > Select 'Targets' tab > Select 'Edit' Select the test server(s) you want to distribute traffic to and click 'Add to Registered', then click 'Save'
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With