When you design and build production-scale solutions, you should avoid single points of failure. For example, having one database and one application instance will cause application failure if either the database or instance fails.
ELB solves the single point of failure problem for AWS services such as EC2 instances and containers. It is a key component of creating a highly available architecture.
Distributes traffic across multiple targets in one or more Availability Zones
Can receive public or private traffic - load balancers can be external facing and distribute inbound public traffic, or internal facing and distribute private traffic
Monitors the health of registered targets with health checks
Routes traffic to only healthy targets
Scales based on incoming traffic - the ELB service scales your load balancer as your incoming traffic changes over time
To discover the availability of your EC2 instances, the load balancer periodically sends pings, attempts connections, or sends requests to test the EC2 instances. These tests are called health checks:
Each registered EC2 instance must respond to the target of the health check with an HTTP status code of 200 to be considered healthy
If an instance fails a health check, a notification is sent to the Amazon EC2 Auto Scaling group to replace the instance with a healthy instance
A load balancer serves as the single point of contact for clients. The load balancer distributes incoming application traffic across multiple targets, such as EC2 instances, in multiple Availability Zones.
Some listeners such as HTTPS and TLS listeners require TLS server certificates on your load balancer to ensure that traffic is protected in transit:
AWS Certificate Manager (ACM) is a service that you can use to provision, manage, and deploy public and private SSL/TLS certificates for use on AWS services such as load balancers
The load balancer uses a server certificate to end the frontend connection and then decrypt requests from clients before sending them to the targets
If you need to pass encrypted traffic to targets without the load balancer decrypting it, you can create a Network Load Balancer or Classic Load Balancer with a TCP listener
An Application Load Balancer functions at the application layer, the seventh layer of the OSI model. After the load balancer receives a request, it evaluates the listener rules in order of priority to determine which rule to apply and then selects a target from the target group for the rule action.
Network Load Balancers can be used to expose a centralized service and function at the fourth layer of the OSI model. They can handle millions of requests per second.
If you’d prefer to use a DNS name that is easier to remember, you can create a custom domain name and associate it with the DNS name for your load balancer
You can create a target group with a single Application Load Balancer as the target and configure your Network Load Balancer to forward traffic to it:
The Application Load Balancer takes over the load balancing decision as soon as traffic reaches it
This configuration combines the features of both load balancers
You can use the layer 7 request-based routing feature of the Application Load Balancer in combination with features that the Network Load Balancer supports, such as endpoint services and static IP addresses
All traffic entering VPC 1 through the internet gateway is first routed to the Gateway Load Balancer endpoint in VPC 1
The traffic is then routed to the Gateway Load Balancer in VPC 2. The Gateway Load Balancer distributes the traffic to the Amazon EC2 security appliance for inspection. The security appliance responds to the Gateway Load Balancer, which returns the inspected traffic to the Gateway Load Balancer endpoint
The Gateway Load Balancer endpoint sends the traffic to the EC2 application instance
Similarly, all traffic leaving the EC2 application instance follows the same path as incoming traffic.
ELB distributes traffic across multiple targets in one or more Availability Zones and monitors the health of registered targets with health checks. An Application Load Balancer is used for application architectures and operates at the OSI model application layer (layer 7), while a Network Load Balancer is used for millions of concurrent, ultra-low latency requests and operates at the OSI model transport layer (layer 4). A Gateway Load Balancer is used to improve security, compliance, and policy controls and operates at the OSI model network layer (layer 3).