2

Is it a good practice to setup 1 autoscaling with multiple target groups. All the target groups registered with same load balancer.

The scenario is Application load balancer LB1 listens on 80 and 443, has the target groups:

"open" Port is http/80

"secure". Port is https/443

If the auto scaling group has target tracking policy on average CPU utilisation, if "open" target group has higher CPU utilisation than "secure". Then there would be no auto scaling?

If alarm is breached how auto scaling group determine which target group should have the new instance?

Do I have to create separate auto scaling. group for each target group. I could not find any amazon docs for this scenario of multiple target group under 1 auto scaling group.

Please let me know

prassank
  • 135
  • 1
  • 9
  • All instances in the ASG will be in two TGs. So it does not matter. A scale out will register a new instance with the two TGs at the same time. – Marcin Apr 29 '20 at 11:28
  • @Marcin There is a problem here if instances from one target group become unhealthy but healthy from other still ASG will not replace as healthy count matches desired count, unless both TG keeps health check pattern as exactly same the instances will never be replaced. If same auto scaling has to monitor two TG's then both TG's has to be somehow interdependent. – prassank Apr 29 '20 at 14:45
  • Interesting point. Don't know. But this is good question for some exterminations. My guess would be that any unhealthy leads to termination of instance. When have time I will try to create ASG with two TGs and check how it works. But I think its better to have two ASGs. Aws docs also do not seem to go to explain how multi-TGs in ASG work exactly. – Marcin Apr 30 '20 at 01:06
  • 2
    I have tried it, The instances retained even if its marked un healfthy from one target group – prassank Apr 30 '20 at 03:01
  • Thanks for letting me know. So two ASGs are preferred choice. – Marcin Apr 30 '20 at 03:19

1 Answers1

1

According to the AWS Documentation

If you attach multiple load balancer target groups or Classic Load Balancers to the group, all of them must report that the instance is healthy in order for it to consider the instance healthy. If any one of them reports an instance as unhealthy, the Auto Scaling group replaces the instance, even if other ones report it as healthy.

My test confirms that behavior with the one exception. Usually people start to configure auto-scaling group with the default settings, which means that the health-check is set to EC2 by default. For the proper work of multiply target groups attached to one auto-scaling group the health check should be set to ELB. If you change it after ASG started up, existing instances are not obey this new setting and retain in the groups.

It may cause the incorrect conclusion like this:

I have tried it, The instances retained even if its marked un healfthy from one target group @prassank

So the answer is:

It is not a good way to attach multiply target groups to a singe auto-scaling group unless you want more strict multiply health checking.

Roman Shishkin
  • 2,097
  • 20
  • 21