Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Enable access logging for ALB from cloudformation

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]

like image 825
Mahbub Rahman Avatar asked Nov 02 '20 03:11

Mahbub Rahman


People also ask

What AWS service can access logs from an application load balancer be delivered?

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.

How do I access CloudFormation logs?

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.

How do you access alb?

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'


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.

like image 129
Marcin Avatar answered Nov 15 '22 16:11

Marcin