2 ELBs (ALBs) to 1 target group, possible

amazon ec2amazon-elbamazon-web-servicesaws-cli

I have the following scheme:

Internet <-> elb1external <-> varnish <-> elb2internal <-> targetgroupofwebnodes

But some /static/* & /media/* are routed to targetgroupofwebnodes from elb1external directly, around varnish & second ELB, so I need both elb1 & elb2 to point to the same target group of web nodes.

The Amazon web console shows the group as grayed out, when I try to select it from the drop down on the second ELB, but I do see mentioning of that scheme being possible on the web.

As a workaround I've created targetgroupofwebnodes2 with the same servers in it, but I'm required to have only 1 & the next task is autoscaling, so there's going to be an autoscaling group instead of target group.

Must I use the CLI for that or there's a way through the web console?

Best Answer

I'm not sure if you can point two ALBs to a single TargetGroup. However since you mentioned AutoScaling you can have the ASG instances automatically registered in more than one TargetGroups, therefore your approach with two target groups will work just as well with AutoScaling.

Hope that helps.

UPDATE #1

The OP was able to find this link to AWS docs on limits titled: Limits for Your Application Load Balancers. In this docs on limits the number of target groups per ALB is mentioned in this table:

Target Group Limits

  • Load balancers per target group: 1
  • Targets per target group (instances or IP addresses): 1000
  • Targets per target group (Lambda functions): 1

Based on this info, you cannot have the same target group in more than one ALB.