0
votes

I have previously setup an AWS Classic Load Balancer with a single instance which serves my node app. However, I am trying to add autoscaling to the LB, so that when under high demand, the LB will distribute traffic between 1 or more instances.

I have tried following the documentation to do this here, but when I view the Autoscaling Group in the console, no instances appear to be running (screenshot attached) Yet, when I view the LB in the console, i see a healthy instance being served (screenshot attached). My app is indeed accessible via the LB url.

When setting up my Autoscaling Group, I have made sure that I added my load Balancer to the Load Balancer property.

How can I find out where the discontinuity is? Why is AWS showing a healthy running instance in my LB console, but my Autoscaling group console shows a 0 instance count?

(Load Balancer console) enter image description here

(Launch Configuration console) enter image description here

(Autoscaling group console) enter image description here

1
Just to double check: 1. the InService instance in the ELB was created by the ASG? 2. What's the information icon next to the zero instances in the ASG says? - imTachu
The InService instance was created prior to creating the ASG. Would that make a difference? - Brett
Yes... Think about this: You have an instance that you created manually working on your ELB, that is working properly... But that instance is never going to be shown in the ASG because well, is not part of it - imTachu
Yes, if you want the instance to be shown inside the ASG, it should be created by it :) - imTachu
Look at it the other way around: You don't create an instance in the ELB to be registered in the ASG... Instead, the ASG creates an instance that will be automatically registered in the ELB. - imTachu

1 Answers

2
votes

When you associate an Auto Scaling Group with an Elastic Load Balancer, the instances are managed by the Auto Scaling group, not the other way around.

So the Auto Scaling Group will create the EC2 instance, then automatically associate them with the Elastic Load Balancer.

It is not possible for an Auto Scaling Group to "absorb" an EC2 instance that was not created by the group. So you have 2 options for your pre-existing EC2 instance:

  1. Continue to allow it to exist "outside the auto scaling group". It will still function as a target for your Elastic Load Balancer, but the Auto Scaling Group will never "own" it.
  2. Terminate that old EC2 instance and let the Auto Scaling Group manage all EC2 instances behind your ELB.

As for this image:

enter image description here

The "0" under the "Instances" column means that the Auto Scaling Group does not have any EC2 instances under it's control. However, that (!) icon next to it means that that fact is probably changing. If you hover your mouse over it, it should tell you that new EC2 instance's are probably launching, etc.

Next, Auto Scaling with t2.micro instances takes time. I don't know the span of time under which these screenshots are taken, as well as what your expectations are, but many times it could take 30 minutes before a t2.micro becomes active behind an ELB.

Finally, do the following:

  1. Monitor your Auto Scaling Group. It should eventually say "1" under the "Instances" column. This means it launched 1 fresh EC2 instance based on your Launch Configuration. If that does not happen, look at the Auto Scaling Group's events and history to find out why.

  2. Only once the ASG says "1", then you can look at the ELB. It should then have 2 EC2 instances behind it (1 original, 1 from ASG). If it does not, then you can look at the ASG configuration to ensure it's registering the EC2 instances with your ELB.

  3. Choose to leave your original EC2 instance or terminate it. But it will never fall under the control of your ASG. Regardless, it will continue to serve requests from your ELB as long as it exists and is registered with your ELB.