- I already have a ELB setup called MyLoadBalancer.
- I already have 2 nodes running on it with health checks (that checks a URL on the node to see if they are up)
- Created an autoscaling group (min 2, Max 10)
- Associated launchconfig mylaunchconfig that provisions a node using an AMI
- Created a trigger, that checks for avg min connections of 100 and Max of 500 (checks the load balancer and it is support to increase the node count by 1, if avg connections are > 500 and decrease by one if less than 100)
as-create-or-update-trigger MyTrigger --auto-scaling-group MyAutoScalingGroup --namespace "AWS/ELB" --measure RequestCount --statistic Average --dimensions "LoadBalancerName=MyLoadBalancer" --period 60 --lower-threshold 500 --upper-threshold 800 --lower-breach-increment=-1 --upper-breach-increment=1 --breach-duration 600
Now the issue is, as soon as I put in the trigger, it start 2 nodes .... but there are already two nodes in the LB.
So, why is it provisioning 2 more nodes, when the nodes are there ? is it because it is not recognizing the existing 2 nodes ? then how do I add the existing nodes to the AutoScaling group ?
I don't believe you can add instances to an auto-scaling group after-the-fact, at least there's no API call to do so. You'll have to let the AutoScaling service launch your instances, then terminate your old ones; after that, you should be golden.
Autoscaling does not recognize nodes already in the load balancer. You have to let autoscaling launch two nodes and terminate the old ones.
For more about aws check this out - http://aws-musings.com