Information
Elastic Load Balancing automatically distributes incoming application traffic across multiple Amazon EC2 instances within a VPC.
It enables greater levels of fault tolerance in your applications, seamlessly providing the required amount of load balancing capacity needed to distribute application traffic across 1 or more Availability Zones within a VPC.
Elastic Load Balancing must be integrated with Auto Scaling Groups to ensure that you have availability of compute resources in the event of a failure.
Integrating Auto Scaling Groups with an Elastic Load Balancer will help provide high availability and back-end EC2 instance scaling.
Through Auto-Scaling Group configuration you can define:
* minimum / maximum number of EC2 instances to be launched by the Auto-Scaling Group
* Availability Zones / subnets used
Solution
Using the Amazon unified command line interface:
* List existing load balancers:
aws elb describe-load-balancers --query 'LoadBalancerDescriptions[*].{ELBName:LoadBalancerName}'
or
* Create new load balancer:
aws elb create-load-balancer --load-balancer-name _<elb_name>_ --listeners _<listener_config>_ --subnets <application_subnet> --security-groups _<application_security_groups>_
* Attached load balancer from previous steps to autoscaling group:
aws autoscaling attach-load-balancers --load-balancer-names <elb_name> --auto-scaling-group-name <autoscaling_group_name>