AWS — Elastic Load Balancer (ELB) Overview

AWS — Elastic Load Balancer (ELB) Overview

Introduction to AWS Elastic Load Balancer — What is ELB?

Amazon Elastic Load Balancer (Amazon ELB) is a load balancing service that automatically distributes incoming application traffic across multiple Amazon Elastic Compute Cloud (Amazon EC2) instances, Amazon ECS tasks, or IP addresses in an Amazon Virtual Private Cloud (Amazon VPC).

With Amazon ELB, you can create a load balancer that listens for incoming traffic on one or more ports, and then forwards the traffic to the Amazon EC2 instances, Amazon ECS tasks, or IP addresses that you have registered with the load balancer. Amazon ELB can automatically scale the number of registered Amazon EC2 instances, Amazon ECS tasks, or IP addresses based on the incoming traffic, and can also monitor the health of the registered resources and automatically remove unhealthy resources from the load balancer.

Types of Elastic Load Balancers

There are three types of Elastic Load Balancers (ELBs) available on the Amazon Web Services (AWS) platform:

Classic Load Balancer:

This is the original load balancer offered by AWS. It is designed to handle traffic for traditional workloads such as EC2 instances, and supports various features such as SSL offloading, health checks, and connection draining.

Application Load Balancer:

The Application Load Balancer (ALB) is a layer 7 load balancer that routes traffic to backend resources based on the content of the request. It is optimized for applications that rely on the HTTP and HTTPS protocols, and it can route traffic to one or more targets, such as EC2 instances, containers, or IP addresses.

ALBs support various routing features, such as:

  1. Path-based routing: This allows you to route traffic to different targets based on the URL path of the request. For example, you could route requests to /api/* to a group of EC2 instances running your API server, and route requests to /static/* to an S3 bucket containing your static assets.

  2. Host-based routing: This allows you to route traffic to different targets based on the hostname of the request. For example, you could route requests to example.com to one set of targets, and route requests to api.example.com to a different set of targets.

  3. Rule-based routing: This allows you to specify routing rules that match certain criteria and route traffic to specific targets. For example, you could create a rule to route traffic to a different set of targets based on the value of a header or a query string parameter.

ALBs also support various other features such as SSL offloading, HTTP/2, WebSockets, and automatic scaling. They are highly available and can scale to millions of requests per second.

Network Load Balancer:

A Network Load Balancer (NLB) is a type of load balancer offered by Amazon Web Services (AWS) that enables you to distribute incoming traffic across multiple targets, such as EC2 instances, containers, and IP addresses, in one or more Availability Zones. NLBs operate at layer 4 of the OSI model, which means they can route traffic based on IP address and TCP port.

NLBs are designed to handle high levels of traffic and can scale to millions of requests per second. They are also highly available, with multiple IP addresses that are distributed across multiple Availability Zones.

There are a few key differences between a Network Load Balancer (NLB) and an Application Load Balancer (ALB):

  1. Protocols: NLBs operate at layer 4 of the OSI model and can route traffic based on IP address and TCP port. ALBs operate at layer 7 and can route traffic based on the content of the request, such as the URL path or hostname. This means that NLBs are suitable for workloads that rely on TCP and UDP protocols, while ALBs are suitable for workloads that rely on HTTP and HTTPS protocols.

  2. Performance: NLBs are designed to handle high levels of traffic and can scale to millions of requests per second. They are also highly available, with multiple IP addresses distributed across multiple Availability Zones. ALBs are also highly available and can scale to millions of requests per second, but they may not provide the same level of performance as NLBs.

  3. Routing: NLBs can route traffic to targets based on IP address and port, and they support features such as health checks, connection draining, and sticky sessions. ALBs support these features as well, but they also offer additional routing features such as path-based routing, host-based routing, and rule-based routing. This allows ALBs to route traffic to different targets based on the content of the request, such as the URL path or hostname.

  4. Features: NLBs support features such as TLS termination, which enables them to terminate SSL/TLS connections and pass decrypted traffic to the targets. ALBs also support TLS termination, as well as additional features such as HTTP/2 and WebSockets.

In general, NLBs are suitable for workloads that require high levels of performance and low latencies, such as real-time applications and gaming. They are also a good choice for workloads that require static IP addresses, such as hybrid cloud architectures. ALBs are suitable for applications that rely on HTTP and HTTPS protocols, and they offer a wide range of routing and traffic management features.

ELB Schemes

An Elastic Load Balancer (ELB) scheme determines whether the load balancer is accessible from the internet or from within a VPC (Virtual Private Cloud). AWS offers two ELB schemes:

  1. Public: A public ELB has a public DNS name and is accessible from the internet. It can route traffic to targets within a VPC or on-premises resources connected to the VPC via a VPN or AWS Direct Connect.

  2. Internal: An internal ELB has a private DNS name and is only accessible from within a VPC. It can route traffic to targets within the VPC, and it cannot be accessed from the internet.

The choice of ELB scheme depends on the requirements of your workload. If you want to make your application or service publicly accessible, you should use a public ELB. If you want to access the load balancer only from within a VPC, such as for internal traffic between microservices, you should use an internal ELB.

ELB Target Types

An Elastic Load Balancer (ELB) can route traffic to multiple targets, such as EC2 instances, containers, or IP addresses. The type of target you choose depends on your workload and the resources you want to use to handle traffic. Here are some common target types for ELBs:

  1. EC2 instances: ELBs can route traffic to one or more EC2 instances running in an Auto Scaling group or a single Availability Zone.

  2. Containers: ELBs can route traffic to one or more containers running on Amazon ECS (Elastic Container Service) tasks or Fargate tasks.

  3. IP addresses: ELBs can route traffic to one or more IP addresses, either within a VPC or on-premises, using a VPC peering connection or a VPN.

  4. Lambda functions: ELBs can route traffic to one or more Lambda functions, allowing you to build serverless applications.

  5. On-premises resources: ELBs can route traffic to on-premises resources connected to a VPC via a VPN or AWS Direct Connect.

It's worth noting that the type of target you choose may depend on the type of ELB you are using. For example, Application Load Balancers (ALBs) are optimized for routing traffic to targets that rely on HTTP and HTTPS protocols, such as EC2 instances or containers, while Network Load Balancers (NLBs) are optimized for routing traffic to targets that rely on TCP and UDP protocols, such as EC2 instances or IP addresses.

ELB Components Architecture

An Elastic Load Balancer (ELB) is a service that distributes incoming traffic across multiple targets, such as EC2 instances, containers, or IP addresses. The ELB architecture consists of the following components:

  1. Load balancer: The load balancer is the central component of the ELB architecture. It sits in front of the targets and receives incoming traffic from clients. The load balancer distributes the traffic to the targets based on the configured load balancing algorithm.

  2. Load balancer nodes: The load balancer is composed of one or more load balancer nodes, which are instances running in multiple Availability Zones. The load balancer nodes receive traffic from clients and distribute it to the targets.

  3. Targets: The targets are the resources that the load balancer distributes traffic to. They can be EC2 instances, containers, IP addresses, or other types of resources.

  4. Health checks: The load balancer periodically sends requests to the targets to verify their health. If a target becomes unhealthy or unavailable, the load balancer stops routing traffic to it.

  5. Monitoring and metrics: The ELB service provides monitoring and metrics to help you understand the performance and availability of the load balancer and the targets.

The ELB architecture is highly available and can scale to millions of requests per second. It is designed to handle high levels of traffic and provide low latencies to clients.

ELB Key Points

  • ELB is one of the most the ideal solution for adding elasticity to your application.

  • ELB does not have predefined IPv4 addresses, it is resolved using DNS name.

  • ELB can manage traffic within a region and not across multiple regions.

  • You can specify only one subnet per Availability Zone (AZ).

  • ELB has more than one listeners. e.g. HTTP, HTTPS.

  • For internet-facing load balancers, the IPv4 addresses of the nodes are assigned by AWS. For internal load balancers, the IPv4 addresses are assigned from the subnet CIDR.

  • To ensure that traffic is evenly distributed, you need to ensure the “Cross-Zone Load balancing” option is enabled.