从 cloudformation 启用 ALB 的访问日志记录

Enable access logging for ALB from cloudformation

我想为我的应用程序负载均衡器启用访问日志记录,在这里我找到了 how to:

的进程

但我想通过 cloudformation 实现同样的事情,发现 只能通过 cloudformation 为 classic load balancer

启用访问日志记录

有什么方法可以为 ALB [elb v2]

实现相同的功能

是的。您可以使用 AWS::ElasticLoadBalancingV2::LoadBalancer Load Balancer Attribute 为 NLB 和 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.