Day 41: Setting up an Application Load Balancer with AWS EC2 ๐Ÿš€ โ˜

Day 41: Setting up an Application Load Balancer with AWS EC2 ๐Ÿš€ โ˜

Day41 of 90daysofdevops

ยท

3 min read

LB2

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 three types of load balancers:

Read more here

  1. Application Load Balancer (ALB) - operates at layer 7 of the OSI model and is ideal for applications that require advanced routing and microservices.

    Read more here

  2. Network Load Balancer (NLB) - operates at layer 4 of the OSI model and is ideal for applications that require high throughput and low latency.

    Read more here

  3. Gateway Load Balancer (GLB) - A Gateway Load Balancer operates at layer 3 of the OSI model. Gateway Load Balancers use Gateway Load Balancer endpoints to securely exchange traffic across VPC boundaries. Use Gateway Load Balancers to deploy, scale, and manage virtual appliances, such as firewalls.

    Read more here

๐ŸŽฏ Today's Tasks:

Task 1:

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

You can see two instances are created.

Copy the public IP address of your EC2 instances.

EC2-1

EC2-2

  • 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.

    Modify the index.html file to include your name so that when your Apache

    the server is hosted, it will display your name also do it for 2nd instance which includes " DevOps Community is Super Awesome :) ".

    1. Connect Instances using SSH.

    2. Go inside the/var/www/html path and edit the index.html file

      While editing the index.html file login as root then proceed further step.

Task 2:

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

Log in to the AWS Management Console and go to the EC2 dashboard

Click on "Load Balancers" in the left-hand navigation menu and then click the "Create Load Balancer" button

Select "Application Load Balancer" as the load balancer type and click "Create".

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

    Register instances in the target group it takes a few minutes to initial

    Create Load balancer

    Now you Successfully Created a Load balancer for the EC2 instance. click on view load balancer and see the all things about your Load balancer.

    Now it Its Time to test your Load Balancer. Copy the DNS name from the Load balancer Description and paste it into a new browser tab and refresh the, again and again, DNS URL.

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

LoadBalancer

Have a great day๐Ÿ™Œ๐Ÿ’ฅ

Happy Learning! ๐Ÿ˜ƒ

Ritul Gupta

ย