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

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

ยท

3 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 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.
  1. Network Load Balancer (NLB) - operates at layer 4 of the OSI model and is ideal for applications that require high throughput and low latency.
  1. Classic Load Balancer (CLB) - operates at layer 4 of the OSI model and is ideal for applications that require basic load balancing features.

๐Ÿ”ถ Task 1: Launch 2 EC2 instances with an Ubuntu AMI and use User Data to install the Apache Web Server.

  • 1. Launch 2 EC2 instances.

    1. Add User Data to install the Apache Web Server in Advance details.

    2. Now verify your both instances are running.

    3. Now connect with SHH and Apache web server is installed or not.

  • 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 1st instance which includes " It works, Nilesh Sahare ".
    For Instance 1:
    Modify index.html by using the root user sudo su and cd /var/www/html

    For Instance 2:
    Modify index.html which includes " TrainWithShubham Community is Super Awesome :) "

  • Copy the public IP address of your EC2 instances.
    Instance 1 :

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

๐Ÿ”ถ Task 2: Create an Application Load Balancer (ALB) in EC2 using the AWS Management Console

  • Create a target group.

    Add both instances to the group and click on create target group.

  • Add EC2 instances that you launch in task-1 to the ALB as target groups.
    Now create a load balancer.

    Configure VPC Network mapping.

    Select a target group.

    Now go target group and select Register targets Check your instances.

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

LoadBalancer

Happy Learning :)

If you find my blog valuable, I invite you to like, share, and join the discussion. Your feedback is immensely cherished as it fuels continuous improvement. Let's embark on this transformative DevOps adventure together! ๐Ÿš€ #devops #90daysofdevop #AWS

ย