6
votes

From here i got this statement: To distribute traffic between the instances in your Auto Scaling groups, you can introduce a load balancer into your architecture

So I created ALB (Application Load Balancer). To my surprise, in the process of creating Auto Scaling group, it's specifically asking for "Classic Load Balancers". Really wonder why aws docs has mentioned this : Elastic Load Balancing supports three types of load balancers: Application Load Balancers, Network Load Balancers, and Classic Load Balancers. You can attach any of these types of load balancers to your Auto Scaling group.

Am i missing something ? please correct.

Question : Why only CLB is required to create Auto Scaling, why not ALB or NLB ? why Amazon is insisting for CLB ?

3
Agreed, this is very frustrating (and it's a year and a half later now). Did you ever figure this out? If so, please come answer your own question in an understandable way for the rest of us :).John Humphreys
Actually, I found a good answer finally - noted below.John Humphreys

3 Answers

0
votes

ALB works in a different way, you would need to create target groups and then select the target group in the Autoscaling settings.

Here are the exact steps to attach an ALB to Autoscaling group..

  1. Do one of the following:

    a. [Classic Load Balancers] For Load Balancers, select your load balancer.

    b. [Target groups] For Target Groups, select your target group.

You can read more about how ALB works here.

0
votes

This was confusing me pretty badly, but then I found the relevant piece of documentation (finally):

If you are registering targets by instance ID, you can use your load balancer with an Auto Scaling group. After you attach a target group to an Auto Scaling group, Auto Scaling registers your targets with the target group for you when it launches them. For more information, see Attaching a Load Balancer to Your Auto Scaling Group in the Amazon EC2 Auto Scaling User Guide.

That came from here: https://docs.aws.amazon.com/elasticloadbalancing/latest/application/load-balancer-target-groups.html.

So, basically, the auto scaling group manages the members of the target group. Then the load balancer balances over the target group. So, when then auto scaling group scales up or down, members are added or removed from the target group, which is the set of nodes that the load balancer is using.

I tried this out and it worked as expected. So:

  1. Create a target group.
  2. Create your auto-scaling-group and point it at the target group.
  3. Create your application-load-balancer and point it at the target group.
  4. On the register-targets page during step #3, you'll see your auto-scaling-group nodes and have peace of mind :).
0
votes

The working principal of the Classic Load Balancer and the Application load balancer in AWS is different.

Classic Load Balancer does not understand the conditions for changing the route based on URL path or the domain based. Hence you can attach the instance directly under the Classic Load balancer. As all the requests are considered same under the Classic Load balancer it does appear as one entity under the EC2 Auto-Scaling group.

Application Load balancer is designed to understand the various condition to route the trafic. Those conditions are path based routing and domain based routing. Due to this you can not attach the EC2 instance under Application load balancer directly, to do that you need to create the target groups and attach the EC2 instance under target group.

Due to this I can say that, you can see the Classic Load balancer option under Auto-Scaling group but not the Application Load balancer directly. To use the Autoscaling group on Application load balancer you need to change the approach to implement the scenario.

Using the AutoScaling group with Application Load balancer
1. Create the Target Group. Refer Creating Target Group page provided by AWS
2. Create the Application Load balancer and refer above created target group under it. You can refer Create application Load balancer page provided by AWS
3. Create Autoscaling group. Refer Create autoscaling group using launch template or Create autoscaling group using launch configuration or Create launch configuration using EC2 Instance or create autoscaling group using launch wizard
4. Attach the load balancer to autoscaling group. Please follow step number 4 and 5a from this link

With the above things you will able to use the autoscaling group with application load balancer. Thanks