Automatically distributes incoming app traffic across multiple targets, such as Amazon EC2 instances. This can be done multi-AZ.
There are three types:
All ELBs can be configured with Health Checks.
The status of the instances that are healthy are In Service
and unhealthy are Out of service
.
ELBs route requests only to healthy instances.
The App Load Balancer functions at the seventh layer of the Open Systems Interconnection (OSI) model.
After the load balancer recieves the request, it evaluates the listener rules in priority order to determine which rule to apply, then selects a target from the target group for the rule action.
Checks for connection requests from clients, using the protocol and port you configured.
You define rules that determine how the load balancer routes requests to its registered targets.
Each rule consists of a priority, one or more actions and one or more conditions.
When conditions for a rule are met, then its actions are performed. You must define a default rule for each listener, and you can optionally define additional rules.
Each target group routes requests to one or more registered targets, such as EC2 instances, using the protocol and port number you specify.
In the example diagram, there may be a listener for port 80 and another listener has multiple rules.
Each listener will redirect to different targets. You can check all targets with a health check.
The demo shows path patterns
for routing to web servers in the same region and media servers in another.
To use HTTPS listener, you must deploy at least one SSL/TLS server cert on your load balancer.
The load balancer uses a server cert to terminate the FE connection and then decrypt requests from clients before sending them to the targets.
In the ELB, you can edit your rules to then add new rules.
The exam tips:
After LB recieves a connection request, it selects a target from the target group for the default rule.
It attemps to open a TCP connection to the selection target on the port specified in the listener configuration.
Check for connection requests from clients, using the protocol and port you configured.
The listener on a Network Load Balancer then forwards the request to the target group. There are no rules, unlike with App Load Balancers.
Each target group routes requests to one or more registered targets, such as EC2 instances, using the protocol and port number you specify.
You can use a TLS listener to offload the work of encryption and decryption to your load balancer so your applications can focus on their business logic.
If the listener protocol is TLS, you must deploy exactly one SSL server certificate on the listener.
Use Cases for NLB: best suited for load balancing of TCP traffic where extreme performance is required. Operating at the connection level (layer 4), NLBs are capable or handling millions of reqs per second, while maintaining ultra-low latencies.
Other use cases:
The legacy load balancers.
X-Forwarded
and sticky sessions.When traffic is sent from a load balancer, the server access logs contain the IP address of the proxy or load balancer only.
To see the original IP of the client, the X-Forwarded-For
req header is used.
If the app stops responding, the Classic Load Balancer responds with a 504
error.
This means the app is having issues. This could be either at the web server layer or database layer.
Classic Load Balancers route each request independently to the registered EC2 instance with the smallest load.
Sticky sessions allow you to bind a user's session to a specific EC2 instance.
This ensures that the same user always lands on the same EC2 instance.
Where could this cause problems? What happens if the EC2 instance is removed from that pool? You will get an error. You can stop that by disbling sticky group sessions.
Tip: You can enable sticky sessions for ALB as well, but the traffic will be sent at the target group level. If there are multiple EC2 instances in that group, they will all be used.
Note: with classic load balancers, this is called connection draining but it is all the same thing.
What is Deregistration Delay?
Allows Load balancers to keep existing connection open if the EC2 instances are de-registered or become unhealthy.
This enables the laod balancer to complete in-flight requests made to instances that are de-registering or unhealthy.
You can disable this if you want your LB to immediately close connections to the instance that are de-registering or have become unhealthy.
Other notes from here: