How do I enable access log for load balancer using ApplicationLoadBalancedFargateService cdk construct

Viewed 118

I have tried this, but the access log is not enabling for Application Load Balancer created by ApplicationLoadBalancedFargateService high-level construct.

// Creating S3 bucket for LoadBalancer Logs
const lbLogs = new s3.Bucket(this, 'S3labxLBaccessLogs');

const loadBalancedService = new ecs_patterns.ApplicationLoadBalancedFargateService(this, 'LogicalID, {
      cluster: cluster, // Required
      cpu: 512, // Default is 256
      desiredCount: 1, // Default is 1
      taskImageOptions: { 
        image: ecs.ContainerImage.fromRegistry('image'),
        },
      memoryLimitMiB: 1024, // Default is 512
      certificate: certificate,
      domainName: domainName,
      domainZone: hostedZone,
      assignPublicIp: true
    });

loadBalancedService.loadBalancer.logAccessLogs(lbLogs, 'microservice-logs');

Any workaround for this?

0 Answers
Related