pythonamazon-web-servicesamazon-elbtroposphereaws-application-load-balancer

ALBV2 logging in s3 bucket and enable deletion protection using Troposphere


First : I want to create access for my ALB to store logs in my s3 bucket,

AccessLoggingPolicy=elb.AccessLoggingPolicy(
                 EmitInterval=5,
                 Enabled=True,
                 S3BucketName="logging",
                 S3BucketPrefix="APPALB",
             ),

Here i defined but this code is for ELBv1 but i am using ELBv2 how can i define it.

Second : Another one i want to create Deletion protection for my elb, I searched alot but i didn't find any where how to do it using Troposphare cloud formation.

        LoadBalancerAttributes=elb.LoadBalancerAttributes(
            DeletionProtection='True',
        )
    ))

Help me Fix this.


Solution

  • Finally i got the answers. Here you can take References.

    LoadBalancerAttributes=[
                elb.LoadBalancerAttributes(
                    Key='deletion_protection.enabled', Value='true',
                ),
                elb.LoadBalancerAttributes(
                    Key='access_logs.s3.enabled', Value='true',
                ),
                elb.LoadBalancerAttributes(
                    Key='access_logs.s3.bucket', Value=Ref(Bucket),
                ),
                elb.LoadBalancerAttributes(
                    Key='access_logs.s3.prefix', Value='Logs',
                ),
            ]