Elastic Load Balancing allows the incoming traffic to be distributed automatically across multiple healthy EC2 instances.
ELB serves as a single point of contact to the client.
ELB helps to being transparent and increases the application availability by allowing addition or removal of multiple EC2 instances across one or more availability zones, without disrupting the overall flow of information.
2. Mahesh TR
Elastic Load Balancer – ELB
• Elastic Load Balancing allows the incoming traffic to be distributed automatically across
multiple healthy EC2 instances.
• ELB serves as a single point of contact to the client.
• ELB helps to being transparent and increases the application availability by allowing addition
or removal of multiple EC2 instances across one or more availability zones, without disrupting
the overall flow of information.
3. Mahesh TR
ELB Benefits
• is itself a distributed system that is fault tolerant and actively monitored
• abstracts out the complexity of managing, maintaining, and scaling load balancers
• can also serve as the first line of defence against attacks on network.
• can offload the work of encryption and decryption (SSL termination) so that the EC2 instances can
focus on their main work
• offers integration with Auto Scaling, which ensures enough back-end capacity available to meet
varying traffic levels
• are engineered to not be a single point of failure
4. Mahesh TR
Elastic Load Balancer
• Elastic Load Balancer, by default, routes each request independently to the registered
instance with the smallest load.
• If an EC2 instance fails, ELB automatically reroutes the traffic to the remaining running
healthy EC2 instances. If a failed EC2 instance is restored, Elastic Load Balancing restores the
traffic to that instance.
• Load Balancers only work across AZs within a region
6. Mahesh TR
Pre-Warming ELB
• ELB works best with gradual increase in traffic.
• AWS is able to scale automatically and handle a vast majority of use cases.
• However, in certain scenarios, if there is a flash traffic spike expected or a load test cannot be
configured to gradually increase traffic, recommended to contact AWS support to have the load
balancer “pre-warmed”
• AWS will help Pre-warming the ELB, by configuring the load balancer to have the appropriate level of
capacity based on expected traffic.
7. Mahesh TR
Classic Load Balancer Types
• Internet Load Balancer
• An Internet-facing load balancer takes requests from clients over the Internet and distributes
them across the EC2 instances that are registered with the load balancer
• Internal Load Balancer
• Internal load balancer routes traffic to EC2 instances in private subnets
8. Mahesh TR
Application Load Balancer
An Application Load Balancer functions at the application layer, the seventh layer of the Open Systems
Interconnection (OSI) model. After the load balancer receives a request, it evaluates the listener rules in priority
order to determine which rule to apply, and then selects a target from the target group for the rule action using
the round robin routing algorithm. Note that you can configure listener rules to route requests to different
target groups based on the content of the application traffic. Routing is performed independently for each
target group, even when a target is registered with multiple target groups.
9. Mahesh TR
Benefits of Migrating from a Classic Load
Balancer
✓ Support for path-based routing. You can configure rules for your listener that forward requests based on the
URL in the request. This enables you to structure your application as smaller services, and route requests to
the correct service based on the content of the URL.
✓ Support for host-based routing. You can configure rules for your listener that forward requests based on the
host field in the HTTP header. This enables you to route requests to multiple domains using a single load
balancer.
✓ Support for routing requests to multiple applications on a single EC2 instance. You can register each instance
or IP address with the same target group using multiple ports.
✓ Support for registering targets by IP address, including targets outside the VPC for the load balancer.
✓ Support for monitoring the health of each service independently, as health checks are defined at the target
group level and many CloudWatch metrics are reported at the target group level. Attaching a target group to
an Auto Scaling group enables you to scale each service dynamically based on demand.
✓ Access logs contain additional information and are stored in compressed format.
✓ Improved load balancer performance.
10. Mahesh TR
Health Checks
• Load balancer performs health checks on all registered instances, whether the instance is in a
healthy state or an unhealthy state.
• Load balancer performs health checks to discover the availability of the EC2 instances, the load
balancer periodically sends pings, attempts connections, or sends request to health check the EC2
instances.
• Health check is InService for status of healthy instances and OutOfService for unhealthy ones
• Load balancer only sends requests to the healthy EC2 instances and stops routing requests to the
unhealthy instances
11. Mahesh TR
Listeners
• Listeners is the process which checks for connection requests from client
• Listeners are configured with a protocol and a port for front-end (client to load
balancer) connections, and a protocol and a port for back-end (load balancer to
back-end instance) connections.
• Listeners support HTTP, HTTPS, SSL, TCP protocols
12. Mahesh TR
Cross-Zone
• By default, the load balancer distributes incoming requests evenly across its enabled Availability
Zones for e.g. If AZ-a has 5 instances and AZ-b has 2 instances, the load will still be distributed 50%
across each of the AZs
• Enabling Cross-Zone load balancing allows the ELB to distribute incoming requests evenly across all
the back-end instances, regardless of the AZ
• Cross-zone load balancer reduces the need to maintain equivalent numbers of back-end instances
in each Availability Zone, and improves application’s ability to handle the loss of one or more back-
end instances.
• It is still recommended to maintain approximately equivalent numbers of instances in
each Availability Zone for higher fault tolerance.
14. Mahesh TR
High Availability & Redundancy
• It is recommended to take advantage of the safety and reliability of geographic redundancy by
using Auto Scaling & ELB by spanning Auto Scaling groups across multiple AZs within a region
and then setting up ELB to distribute incoming traffic across those AZs.
• Incoming traffic is load balanced equally across all the AZs enabled for ELB