I have an application load balancer with a HTTPS Listener that was created before I started using CDK.
The listener already has 13 rules which route requests based on hostname to different fargate instances. The last rule is a fallback rule.
Now I want to insert new rules with CDK before the fallback rules. As there will be new rules when adding new fargate services, this must be dynamic. How can I add new rules to an existing listener and how can I get the priority of a specific rule (the fallback rule in this case) to serve as a starting point for the priority calculation
Or could I just add rule after rule all with priority 1 and the priority of the already existing rules would be increased by 1 each?
I retrieved the existing listener this way but I have no idea how to access its rules
const httpsListener = elbv2.ApplicationListener.fromLookup(
this,
"ALBListenerHTTPS", {
listenerArn: "my:aws:alb:listener:arn",
}
);