Application Load Balancer With AWS EC2
Application Load Balancer With AWS EC2
Maninder Singh
Dear Learners, In Previous articles we will learn the AWS basics & IAM. In today article we will learn the Load Balancing with AWS EC2.
Load balancing is the distribution of workloads across multiple servers to ensure consistent and optimal resources utilisation. It is an essential aspect of
any large-scale computing system. It helps you to improve the reliability and performance of your applications.
ELB (Elastic load balancing) is a service provided by Amazon web services that automatically distributes incoming traffic across multiple Ec2 instances.
ELB provides 3 types of load balancer.
Application Load balancer Diagram.
It works and operates at layer 7 of the OSI model and is ideal for applications that require advanced routing and microservices.
Operates at layer 4 of the OSI model and is ideal for application that requires high throughput and low latency.
operates at layer 4 of the OSI model and is ideal for application that require basic load balancing features.
Task1:
launch 2 Ec2 instances with an Ubuntu AMI and user user data to install the Apache web Server.
Choose the instance type,configure the instance details,add storage and configure security groups as required.
add storage and configure security groups as required Diagram.
In the "user data" field enter the following commands to install and start the "Apache web server"
#!/bin/bash
After creating the both instances you can modify the index.html file. (Path is sudo nano /var/www/index.html). it will display your name also do it for 2
instances which include "Train with shubham community is super Awesome:".
For apache-server1
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.
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.
copy the public ip address of your Ec2 instances for Server 2 Diagram.
Task2:
Create an Application Load Balancer (ALB) in EC2 using the AWS Management Console.
Click on "Load Balancers" in the left side navigation menu and then click the "Create Load Balancer" button.
Click on "Load Balancers" in the left side navigation menu Diagram,
Select "Application Load Balancer" as the load balancer type and click "create"
Select "Application Load Balancer Diagram.
Now Configure the load balancer as per your need such as listener,security group and availability zones. For the listener you can choose HTTP or HTTPS
depending on your application's requirements.
Provide a name to your Application load balancer Diagram.
Create a target group by specifying a name,protocol,port,and health check settings. choose the same availability zones as the load balancer and select the
instances that you launched in Task-1 as targets for the target group.
targets for the target group Diagram
Add Ec2 instances which you launch in task-1 to the ALB as target groups.
Add Ec2 instances which you launch in task-1 to the ALB as target groups Diagram.
Add Ec2 instances which you launch in task-1 to the ALB as target groups Register create diagram.
Review option:-
Create Diagram.
Now its time to verify the ALB is working properly by checking the health status option of the target instances and testing the load balancing capabilities.
Verify that the instances are registered with the load balancer by checking the target group health status. you should see a healthy status for all the
instances in the group.
healthy status for all the instances in the group Diagram.
Testing the load balancer capabilities by accessing the load balancer DNS name in web browser. you should see the traffic is being envely distribution
across the both instances.
Copy the DNS name and hit it into the browser one by one.
Copy the DNS name and hit it into the browser one by one Diagram.
Apache server1
Apache server 1 Diagram.
In this blog, I have discussed AWS Ec2 Load Balancer with the help of task how we can manage(balance) our Application load between 2 Servers. If you
have any questions or would like to share your experiences, feel free to contact me or leave a comment.
Thank you for reading !! I hope you find this article helpful!!
Happy Learning !!
Next Topic: