Use ELB to distribute incoming application traffic in your Amazon EC2 Auto Scaling group - Amazon EC2 Auto Scaling

Use ELB to distribute incoming application traffic in your Amazon EC2 Auto Scaling group

Elastic Load Balancing automatically distributes your incoming application traffic across all the EC2 instances that you are running. ELB helps to manage incoming requests by optimally routing traffic so that no one instance is overwhelmed. To use ELB with your Amazon EC2 Auto Scaling group, attach the load balancer to your Amazon EC2 Auto Scaling group. This registers the group with the load balancer, which acts as a single point of contact for all incoming web traffic to your Amazon EC2 Auto Scaling group.

When you use ELB with your Amazon EC2 Auto Scaling group, it's not necessary to register individual EC2 instances with the load balancer. Instances that are launched by your Amazon EC2 Auto Scaling group are automatically registered with the load balancer. Likewise, instances that are terminated by your Amazon EC2 Auto Scaling group are automatically deregistered from the load balancer.

After attaching a load balancer to your Amazon EC2 Auto Scaling group, you can configure your Amazon EC2 Auto Scaling group to use ELB metrics (such as the Application Load Balancer request count per target) to scale the number of instances in the group as demand fluctuates.

Optionally, you can add ELB health checks to your Amazon EC2 Auto Scaling group so that Amazon EC2 Auto Scaling can identify and replace unhealthy instances based on these additional health checks. Otherwise, you can create a CloudWatch alarm that notifies you if the healthy host count of the target group is lower than allowed.

ELB types

ELB provides four types of load balancers that can be used with your Amazon EC2 Auto Scaling group: Application Load Balancers, Network Load Balancers, Gateway Load Balancers, and Classic Load Balancers.

There is a key difference in how the load balancer types are configured. With Application Load Balancers, Network Load Balancers, and Gateway Load Balancers, instances are registered as targets with a target group, and you route traffic to the target group. With Classic Load Balancers, instances are registered directly with the load balancer.

Application Load Balancer

Routes and load balances at the application layer (HTTP/HTTPS), and supports path-based routing. An Application Load Balancer can route requests to ports on one or more registered targets, such as EC2 instances, in your virtual private cloud (VPC).

Network Load Balancer

Routes and load balances at the transport layer (TCP/UDP Layer-4), based on address information extracted from the Layer-4 header. Network Load Balancers can handle traffic bursts, retain the source IP of the client, and use a fixed IP for the life of the load balancer.

Gateway Load Balancer

Distributes traffic to a fleet of appliance instances. Provides scale, availability, and simplicity for third-party virtual appliances, such as firewalls, intrusion detection and prevention systems, and other appliances. Gateway Load Balancers work with virtual appliances that support the GENEVE protocol. Additional technical integration is required, so make sure to consult the user guide before choosing a Gateway Load Balancer.

Classic Load Balancer

Routes and load balances either at the transport layer (TCP/SSL), or at the application layer (HTTP/HTTPS).

To gain a deeper understanding of the different types of load balancers available, see the following resources: