Day 41 : Setting up an Application Load Balancer with AWS EC2

Rahul SinghRahul Singh
2 min read

What is Load Balancing?

Load balancing is the distribution of workloads across multiple servers to ensure consistent and optimal resource utilization. It is an essential aspect of any large-scale and scalable computing system, as it helps you to improve the reliability and performance of your applications.

Elastic Load Balancing:

Elastic Load Balancing (ELB) is a service provided by Amazon Web Services (AWS) that automatically distributes incoming traffic across multiple EC2 instances. ELB provides four types of load balancers:

  1. Application Load Balancer : Routes and load balances at the application layer (HTTP/HTTPS), and supports path-based routing. An Application Load Balancer can route requests to ports on one or more registered targets, such as EC2 instances, in your virtual private cloud (VPC).

  2. Network Load Balancer : Routes and load balances at the transport layer (TCP/UDP Layer-4), based on address information extracted from the Layer-4 header. Network Load Balancers can handle traffic bursts, retain the source IP of the client, and use a fixed IP for the life of the load balancer.

  3. Gateway Load Balancer : Distributes traffic to a fleet of appliance instances. Provides scale, availability, and simplicity for third-party virtual appliances, such as firewalls, intrusion detection and prevention systems, and other appliances. Gateway Load Balancers work with virtual appliances that support the GENEVE protocol. Additional technical integration is required, so make sure to consult the user guide before choosing a Gateway Load Balancer.

  4. Classic Load Balancer : Routes and load balances either at the transport layer (TCP/SSL), or at the application layer (HTTP/HTTPS).

Tasks:

Task 1:

  • launch 2 EC2 instances with an Ubuntu AMI and use User Data to install the Apache Web Server.

  • Modify the index.html file to include your name so that when your Apache server is hosted, it will display your name also do it for 2nd instance which include " TrainWithShubham Community is Super Aweasome :) ".

  • Copy the public IP address of your EC2 instances.

  • Open a web browser and paste the public IP address into the address bar.

  • You should see a webpage displaying information about your PHP installation.

Task 2:

  • Create an Application Load Balancer (ALB) in EC2 using the AWS Management Console.

  • Add EC2 instances which you launch in task-1 to the ALB as target groups.

  • Verify that the ALB is working properly by checking the health status of the target instances and testing the load balancing capabilities.

0
Subscribe to my newsletter

Read articles from Rahul Singh directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Rahul Singh
Rahul Singh