Day 41 - Mastering Application Load Balancer with AWS EC2 ๐Ÿš€โ˜๏ธ

Nilkanth MistryNilkanth Mistry
3 min read

Load Balancing in AWS: A Comprehensive Guide to ALB, NLB, GLB, and CLB

๐Ÿš€ Day 41 of #90DaysOfDevOpsChallenge is here! Today, let's explore the world of Load Balancing with AWS EC2! โ˜๏ธ

Load balancing is like having multiple cashiers at a supermarket checkout ๐Ÿ›’. It ensures that all customers are served efficiently, reducing wait times and improving overall experience. Here's a breakdown with emojis:

๐Ÿ” What is Load Balancing?

Load balancing distributes workloads across multiple servers to ensure consistent and optimal resource utilization. It's like spreading the workload evenly across multiple cashiers to handle customer traffic efficiently.

๐ŸŽฏ Elastic Load Balancing (ELB) with AWS:

AWS Elastic Load Balancer | AWS Load Balancer Types

Elastic Load Balancing (ELB) is an AWS service that automatically distributes incoming traffic across multiple EC2 instances. It offers three types of load balancers:

๐ŸŽˆ Application Load Balancer (ALB):

AWS Application Load Balancer algorithms | by Simon Tabor | DAZN  Engineering | Medium

ALB operates at layer 7 of the OSI model and is perfect for applications needing advanced routing and microservices. It's like directing customers to specific cashier lanes based on their needs, ensuring efficient service.

๐Ÿš€ Network Load Balancer (NLB):

Application Load Balancer-type Target Group for Network Load Balancer |  Networking & Content Delivery

NLB operates at layer 4 of the OSI model and is ideal for applications needing high throughput and low latency. It's like ensuring customers are directed to the fastest cashier lane available.

๐Ÿข Classic Load Balancer (CLB):

CLB operates at layer 4 of the OSI model and is suitable for applications needing basic load balancing features. It's like having a traditional checkout system where customers are evenly distributed among available cashiers.

๐Ÿš€ Task 1: Launch EC2 Instances and Install Apache Web Server

  1. ๐Ÿ”‘ Log in to your AWS Console and navigate to the EC2 dashboard.

  2. ๐Ÿ–ฑ๏ธ Click on the "Launch Instance" button and select "Ubuntu Server".

  3. ๐Ÿ› ๏ธ Choose the instance type, configure details, add storage, and set up security groups

  4. ๐Ÿ“ Scroll down to the "User data" section under "Advanced Details" and enter commands to install Apache:

#!/bin/bash
sudo apt update -y
sudo apt install apache2 -y
sudo systemctl start apache2
sudo systemctl enable apache2

  1. ๐Ÿ–ฅ๏ธ Repeat steps for the second instance.

  2. ๐Ÿ–ฑ๏ธ Copy the public IP addresses of your instances.

  3. ๐ŸŒ Open a web browser and paste the IP addresses to view the Apache default page.

  4. โœ๏ธ Modify the index.html file in /var/www/html to add your name on the first instance and "Nilkanth Mistry - 90DaysOfDevOps January is Super Awesome :)" on the second instance.

modify index.html file:

๐ŸŽฏ Task 2: Create Application Load Balancer (ALB)

  1. ๐Ÿ”‘ Log in to AWS Management Console and navigate to the EC2 dashboard.

  2. ๐Ÿ”„ Click on "Load Balancers" in the left menu and then "Create Load Balancer".

  3. ๐ŸŒ Select "Application Load Balancer" and click "Create".

  4. โš™๏ธ Configure settings, including name, listener, security group, and availability zones.

  5. ๐Ÿงญ Configure security groups and create a target group with the same availability zones as the load balancer.

  6. ๐ŸŽฏ Add the EC2 instances from Task 1 as targets for the target group.

  7. โœ… Verify that the instances are registered and healthy in the target group.

  8. ๐Ÿ› ๏ธ Test the load balancing by accessing the load balancer's DNS name in a web browser.

That's it! Your Application Load Balancer is set up and ready to evenly distribute traffic across your EC2 instances. Happy load balancing! ๐ŸŒ๐Ÿ”€๐Ÿš€

0
Subscribe to my newsletter

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

Written by

Nilkanth Mistry
Nilkanth Mistry

Embark on a 90-day DevOps journey with me as we tackle challenges, unravel complexities, and conquer the world of seamless software delivery. Join my Hashnode blog series where we'll explore hands-on DevOps scenarios, troubleshooting real-world issues, and mastering the art of efficient deployment. Let's embrace the challenges and elevate our DevOps expertise together! #DevOpsChallenges #HandsOnLearning #ContinuousImprovement