What is Load Balancing? A Detailed Guide for Beginners

Table of contents

What is load balancing ?

Load balances are services that forward traffic to multiple servers (Ex. : EC2 instance) downtime.

Why we use a load balancer ?

  • Spread load across multiple downstream instance.

  • Expose a single point of access (DNS) yo your application.

  • Seamlessly handle failures of downstream instances.

  • Do regular health checks to your instance.

  • High availability across zones.

  • Separate public traffic from private traffic.

What is Elastic load Balancing

Elastic load balancing automatically distributes your incoming traffic across multiple targets, such as EC2 instances, containers and IP addresses, in one or more Availability zones, It monitors the health of its registered targets. Elastic load balancing scales your load balancer capacity automatically in response to changes in incoming traffic.

Load Balancer Benefits :

  • A load balancer distributes workloads across multiple compute resources, such as virtual servers, using a load balancer increases the availability and fault tolerance of your application.

  • You can add and remove compute resources from your your load balancer as your needs change, without disrupting the overall flow of requests to your application.

  • You can configure health checks, which monitor the health of the compute resources, so that the load balancer sends 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.

Health checks :

  • Health cheeks are crucial for load balancers.

  • They enable the load balancer to know if instances it for words traffic to are available to reply to requests.

  • The health checks is, done on a port and route. (/health is common)

  • If the response is not 200 (ok), then the instance is unhealthy.

Types of load balancers on AWS.

  • Application load Balancer (v2- new generation) : HTTP, HTTPS, web socket.

  • Network load Balancer (v2- new generation) : TCP, TLS (Secure TCP), UDP.

  • Gateway load Balancer - Operates at layer 3 (Network layer -IP Protocol).

Application Load Balancers :

  • Application load balancers is layer 7 (HTTP)

  • Load balancing to multiple HTTP applications across machine (target groups)

  • Load balancing to multiple applications on the same machine ( Ex. : Containers)

  • support redirects (from HTTP to HTTPS)

How to create Application load balancer ?

First create a two EC2 instance, allow HTTP and HTTPS services and Install Web server.

  1. Go to EC2 Dashboard Left side bar Load Balancers.

  2. Under load balancing Click Load Balancer.

  3. Click Create Load Balancer.

  4. Select Application Load Balancer and Click Load Balancer.

  5. Configure Load Balancer

  6. Name: Enter a name (Ex. : myloadbalancer ) .

  7. Scheme: Choose Internet - facing.

  8. IP address type: IPv4

  9. Network mapping : VPC default

  10. Availability Zone : Select at least two Availability Zones and their subnets for high availability.

  11. Security Groups select default.

  12. Listeners and routing set as default.

  13. Create target group : Target group

    Instance - target group name

    Health check path - / give path

    click next

    Select machine

    Include as pending below

    Create target group

  14. Return to the Load balancer

  15. Select target Groups and click Create load balancer.

How to check load balancing

  • Copy DNS name and paste on the google.

Conclusion:

Creating a Load Balancer in AWS, particularly an Application Load Balancer, is a straightforward process that enhances the scalability, reliability, and availability of your applications. By distributing incoming traffic across multiple targets and availability zones, AWS Load Balancers help ensure consistent performance and fault tolerance. Understanding and properly configuring each step—from listeners to target groups—lays the foundation for a resilient and highly available cloud infrastructure.

0
Subscribe to my newsletter

Read articles from Tambadkar Rohit Yashwant directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Tambadkar Rohit Yashwant
Tambadkar Rohit Yashwant

Learning DevOps Engineer passionate about cloud computing, containerization, and automation. Currently exploring Docker, AWS, and CI/CD pipelines to build scalable and efficient workflows. Documenting my learning journey in blog. stay tuned with me for learning.