Day 41: Setting up ALB/NLB with AWS EC2

 

📈 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 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-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:

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

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+++++++++++++++++++++++++++

Comments