Day 41: Setting up ALB/NLB with AWS EC2 ๐Ÿš€ โ˜

Day 41: Setting up ALB/NLB with AWS EC2 ๐Ÿš€ โ˜

ยท

3 min read

Load Balancer:

๐Ÿ“ˆ Load Balancers are like traffic controllers, helping to distribute network traffic among multiple targets to improve application availability and scalability.

๐ŸŽฏ Application Load Balancers (ALBs) can route traffic based on URL paths or host headers, while Network Load Balancers (NLBs) handle TCP and UDP traffic with ultra-low latencies.

๐Ÿ’ป Classic Load Balancers (CLBs) are the legacy option that can handle HTTP, HTTPS, TCP, and SSL traffic.

๐ŸŒŸ Using a Load Balancer in AWS can help balance workloads and ensure that applications remain available and responsive to user requests.

Application Load Balancer (ALB):

๐ŸŒ Application Load Balancers (ALBs) are like gatekeepers for web applications, helping to distribute incoming network traffic among multiple targets based on the content of the request, such as the URL path or the host header.

๐ŸŽฏ ALBs can route traffic to different target groups, each with its own set of Amazon Elastic Compute Cloud (EC2) instances or containers.

๐Ÿ” ALBs also support SSL/TLS termination, enabling secure communication between clients and servers.

๐Ÿš€ With features like path-based routing and host-based routing, ALBs help ensure that web applications remain available and responsive to user requests.

Step-by-Step Guide to Configuring an ALB in AWS:

Step-1: Launch 2 Instance Server Configure index.html page and try to access it on the browser:

sudo apt install apache2
sudo systemctl start apache2

Step-2 Now Try to access it with the Public IP of Both Instances:

Step-3 Setup an Application Load Balancer for Both Servers:

Create a Target Group for both Instance Servers:

Now Setup Application Load Balancer for this Particular Target Group:

Select Application Load Balancer:

Choose your existing Target Group to setup ALB:

At last, it got successful :

Now wait for some time to set up as it can be in Provisioning State, one it active try to access our webpages with ALB DNS:

Again Refresh it:

Step-by-Step Guide to Configuring a Path-Based ALB in AWS:

amazon web services - How to do port forwarding in AWS ALB - Stack Overflow

First, Create two Target Groups and select both instances for a particular target group:

Setup ALB with Path-Based Routing:

Click on Listner View and Edit rule in ALB:

Insert Route here:

Now if you put DNS of ALB it will show up only the default Webpage which was setup to target group1 :

Now try to access it with secondlb-1047233398.ap-northeast-3.elb.amazonaws.com/morning or /evening

Put your index.html file in a particular path i.e /morning

Network Load Balancers (NLBs):

๐ŸŒ Network Load Balancers (NLBs) are like high-speed routers, helping to distribute incoming network traffic among multiple targets with ultra-low latencies.

๐ŸŽฏ NLBs handle TCP and UDP traffic, making them ideal for highly scalable applications that require fast, consistent performance.

๐Ÿ”’ NLBs also support SSL/TLS encryption for secure communication between clients and servers.

๐Ÿš€ With features like cross-zone load balancing and connection draining, NLBs help ensure that traffic is distributed evenly across healthy targets and that clients are not impacted by target outages or scaling events.

Step-by-Step Guide to Configuring a Network Load Balancer in AWS:

Setup NLB and create a Target group with IP Address:

Left it as it is, we will configure it later with the private IP of two instances:

Add Private ip in Target group, click on edit and add it:

Now try to access LB DNS :

++++++++++++++++++++Thank you+++++++++++++++++++++++++++

ย