How can I configure the same pool of instances for multiple ALBs, using target and autoscaling groups?

0

My SaaS hosts multiple domains. Each application load balancer can host up to 20 domains. Therefore I have to create multiple load balancers for my application (1 for each 20 domains).

What I want is a single pool of EC2 instances available to autoscale for traffic coming from such multiple ALBs.

Here is what I did to avoid complexities of setting up an NLB (and additional cost of NLBs).

ALB-1 -> Autoscaling Group-1 -> Target Group-1 -> Instance-1

ALB-2 -> Autoscaling Group-2 -> Target Group-2 -> Instance-1

E.g. both target groups have the same instance, but serving different load balancers and autoscalers.

The reason I do this is, why should I use seperate pools of instances that would be idle, sharing and autoscaling from one pool is more efficient.

Would this design work? What type of issues would I run into?

Edit: Problem is solved by using a single ASG for both target groups as follows:

Autoscaling Group-1 -> Target Group-1 and Target Group-2

ALB-1 -> Target Group-1 -> Instance-1

ALB-2 -> Target Group-2 -> Instance-1

Here is a key follow up question:

Are there implications if I place the same instance "Instance-1" into 2 target groups associated with 2 ALBs?

The primary reason I do this is, the first ALB/ASG/Target Group/Instance is configured by Elastic Beanstalk. I target the same instances from other ALBs, because if I manually add a separate instance to the 2nd target group the instances will not have the application backend stack that gets auto-installed by Elastic Beanstalk.

Also, at what point would the network traffic saturate and I need to add an NLB in this design?

Thanks!

1 Risposta
1

When an instance is in an ASG its lifecycle is managed by the ASG ... if you have two ASGs attempting to do this for the one instance it could end badly. Better would be to have a single ASG attached to multiple ALBs. This is a supported architecture.

ESPERTO
con risposta un anno fa
  • Thanks for the answer. I just discovered this as well, an ASG is not strictly associated with 1 ALB. I can use the original ASG to scale 2 target groups.

    The updated design:

    Autoscaling Group-1 -> Target Group 1 and 2 ALB-1 -> Target Group-1 -> Instance-1 ALB-2 -> Target Group-2 -> Instance-1

Accesso non effettuato. Accedi per postare una risposta.

Una buona risposta soddisfa chiaramente la domanda, fornisce un feedback costruttivo e incoraggia la crescita professionale del richiedente.

Linee guida per rispondere alle domande