aws application load balancer finding the automatically generating a listener

Viewed 557

I'm using aws_cdk aws_elasticloadbalancingv2 to generate application load balancer. When this generates it creates a public listener on its own for port 80. How do I find the listener arn using cdk python? I don't know the listener arn. I only have the load balancer that I created arn. Should I be able to change this listener to be a redirect action instead of forward action?

1 Answers

The python's ApplicationListener class in CDK has listener_arn property.

Thus if you create a listern, you can use that property. For example:

listener = lb.add_listener("Listener", port=80)
arn = listener.listener_arn

Full example is here.

Related