AWS – Load Balancer

ELB automatically distributes incoming application traffic across multiple targets, such as Amazon EC2 instances, containers, IP addresses, and Lambda functions.

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. This increases the availability of your application. You add one or more listeners to your load balancer.

Types of Load Balancer

  • 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. You can configure listener rules to route requests to specific webservers or 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.
  • Network Load Balancer – a Network Load Balancer functions at the 4th layer of the (OSI) model. It can handle millions of requests per second. After the load balancer receives a connection request, it selects a target from the target group for the default rule. It attempts to open a TCP connection to the selected target on the port specified in the listener configuration. It is best suited for load balancing of TCP traffic where extreme performance is required.
  • Classic Load Balancer – a load balancer distributes incoming application traffic across multiple EC2 instances in multiple Availability Zones. This increases the fault tolerance of your applications. Elastic Load Balancing detects unhealthy instances and routes traffic only to healthy instances. It is a legacy load balancer. You can load balancer HTTP/HTTPS applications and use layer 7-specific features, such as X-forwarded and sticky sessions. You can also use strict layer 4 load balancing for applications that rely purely on the TCP protocol.

Load Balancer Benefits

  • Using a load balancer increases the availability and fault tolerance of your applications. A load balancer distributes workloads across multiple compute resources, such as virtual servers.
  • You can add and remove compute resources from your load balancer as your needs change, without disrupting the overall flow of requests to your applications.
  • You can configure health checks, which are used to monitor the health of the compute resources so that the load balancer can send requests only to the healthy ones.
  • You can also offload the work of encryption and decryption to your load balancer so that your compute resources can focus on their main work.

Load Balancer Errors

If load balancer stops working or timeouts, the classic load balancer will return 504 error.

X-Forwarded-For Header

Internet Facing ELB

  • ELB nodes have public IPs
  • Routes traffic to the private IP addresses of the EC2 instances
  • Need one public subnet in each AZ where the ELB is defined
  • ELB DNS name format: <name>-<id-number>.<region>.elb.amazonaws.com
  • The internet-facing load balancer has public IP addresses and the usual Elastic Load Balancer DNS name. Your web servers can use private IP addresses and restrict traffic to the requests coming from the internet-facing load balancer. The web servers, in turn, will make requests to the internal load balancer, using private IP addresses that are resolved from the internal load balancers DNS name, which begins with internal-. The internal load balancer will route requests to the application servers, which are also using private IP addresses and only accept requests from the internal load balancer.

Internal Load Balancer

  • ELB nodes have private IPs
  • Routes traffic to the private IP addresses of the EC2 instances
  • ELB DNS name format: internal-<name>-<id-number>.<region>.elb.amazonaws.com

AWS Load Balancer Developer Guide




Subscribe To Our Newsletter
You will receive our latest post and tutorial.
Thank you for subscribing!

required
required


Leave a Reply

Your email address will not be published.