Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AWS multiple ELBs for a Auto Scaling Group

Per AWS documentation you can attach multiple Load Balancers to a Single Auto Scaling Group. I would think there would be 1:1 relationship between ELB and ASG. If ASG scales which ELB does it update- All. How does this work, what is the use case.

like image 711
Sam-T Avatar asked Oct 18 '17 04:10

Sam-T


People also ask

What is an AWS auto scaling group?

What is an AWS Auto Scaling Group? An AWS Auto Scaling group (ASG) is a fleet of EC2 instances that can scale up or down depending on application demand.

How does Amazon EC2 auto scaling work?

If a scaling action occurs, Amazon EC2 Auto Scaling automatically maintains balance across all of the Availability Zones that you specify. If you're new to Auto Scaling groups, start by creating a launch template or a launch configuration and then use it to create an Auto Scaling group in which all instances have the same instance attributes.

How to deploy EC2 instances using auto scaling groups?

To deploy EC2 instances using Auto Scaling groups, architects must choose between numerous factors such as Amazon Machine Instances (AMIs), EC2 instance types, placement groups, and security considerations. Related to scaling, they also need to consider what the minimum, maximum, and desired capacity would be, and how and when to scale.

What is an auto scaling Group (ASG)?

The goal of an Auto Scaling Group (ASG) is to: i) Scale-out (addEC2 instances) to match an increased load, ii) Scale in (remove EC2 instances) to match a decreased load, iii) Ensure we have a minimum and a maximum number of machines running, iv) Automatically Register new instances to a load balancer.


2 Answers

Although you can attach, multiple load balancers to a single Auto Scaling group, its rarely being used, specially after AWS introduced Application Load Balancer (ALB) with support for Routing Rules (Domain and Path based) and attaching multiple SSL Certificates for a single load balancer features.

For example few scenarios where it was required previously (Before above mentioned new features were available.)

  1. If you have multiple applications running inside an EC2 (Although it's not recommended) and needed their own SSL certificates, it'd be required to point to multiple load balancers.
  2. If you have an Application Proxy Auto Scaling Group which points to backend services with their own SSL.
  3. For different path and port mappings for internal applications in EC2 (Similar to Point 1)
like image 182
Ashan Avatar answered Nov 15 '22 16:11

Ashan


Looking at the AWS documentation you can attach multiple Load Balancers to an ASG. When the ASG scales up all the Load Balancers will know about the new EC2 instances.

Auto Scaling integrates with Elastic Load Balancing to enable you to attach one or more load balancers to an existing Auto Scaling group. After you attach the load balancer, it automatically registers the instances in the group and distributes incoming traffic across the instances

link to above quote can be found here

In terms of scaling down if one of load balancers is reporting an instance as unhealthy then the instance will be considered unhealthy and eventually terminated.

If you configure your Auto Scaling group to determine health status using both EC2 status checks and Elastic Load Balancing health checks, Auto Scaling considers the instance unhealthy if it fails either the status checks or the health check. Note that if you attach multiple load balancers to an Auto Scaling group, all of them must report that the instance is healthy in order for Auto Scaling to consider the instance healthy. If one load balancer reports an instance as unhealthy, Auto Scaling replaces the instance, even if other load balancers report it as healthy

Link to above quote can be found here

I hope this makes things a bit clearer.

like image 35
LittleBigUllah Avatar answered Nov 15 '22 17:11

LittleBigUllah