问题
We have multiple SSL certificates for a group of EC2 server (due to legacy constraints). We have multiple ELBs pointing at this group, each terminating the SSL for a specific certificate. We now want to move to auto-scaling instead of a hard-coded list of EC2 instances. Will a single auto-scaling group work with multiple ELBs?
回答1:
Yes it works (we do this since some years). The autoscaling group automatically attaches new instances to each ELB. If you use the command line tools you can create an autoscaling group with multiple ELBs, e.g.:
as-create-auto-scaling-group mygroup ... --load-balancers lb1,lb2,lb3
Once you've created the group, you cannot update the list of load-balancers. If you want to update the list of ELBs in a group you need to create a new one and delete the replaced one. Simple as that.
回答2:
It should work, but the autoscaling mechanism will only automatically associate your instances with 1 load balancer.
You will need to add some kind of health check scripts which can associate/disassociate instances as your auto scaling group scales up and down. You may be able to run these as start up and showdown scripts on the instances themselves.
回答3:
As an update to Dennis' answer, AWS does now offer the ability to associate an existing Auto-Scale Group with an Elastic Load Balancer via the CLI and the Console.
Ex. Classic ELBs
aws autoscaling attach-load-balancers --auto-scaling-group-name my-asg --load-balancer-names my-lb
Ex. Application Load Balancer
aws autoscaling attach-load-balancer-target-groups --auto-scaling-group-name my-asg --target-group-arns my-targetgroup-arn
Reference: https://docs.aws.amazon.com/autoscaling/latest/userguide/attach-load-balancer-asg.html#as-add-load-balancer-aws-cli
来源:https://stackoverflow.com/questions/19689164/multiple-elbs-for-a-single-auto-scaling-group