Read on:

AWS for Beginners: Understanding AWS Terminologies: Part 1
AWS for Beginners: What is AWS EC2: Part 2
AWS for Beginners: AWS Compute Services: Part 3
Read More

Elastic Load Balancer (ELB) has the ability to automatically distribute the traffic among numerous backend destinations, including EC2 instances, IP addresses, and containers. It monitors the health status of the targets and only forwards traffic to healthy backend. It helps to keep your application always available instead of multiple unhealthy targets.

Protect Your Data with BDRSuite

Cost-Effective Backup Solution for VMs, Servers, Endpoints, Cloud VMs & SaaS applications. Supports On-Premise, Remote, Hybrid and Cloud Backup, including Disaster Recovery, Ransomware Defense & more!

Types of Elastic Load Balancer

  • Application Load balancer
  • Network Load balancer
  • Gateway Load balancer
  • Classic Load balancer

Today we will use Application Load balancer in this article.

How Application Load Balancer works?

It automatically distributes incoming traffic across multiple healthy targets.

Application Load Balancer

Download Banner

Application Load Balancer supports both Http and Https traffic. It has the capability to do SSL offloading. Path based routing is also supported.

Architecture to Follow

Application Load Balancer

Load Balancer: The load balancer distributes incoming application traffic across multiple targets to increase application availability.

Listener: A listener validates incoming connection requests from clients using the protocol and port chosen by an organization in accordance with preset rules that regulate the routing of requests to registered targets by the Application Load Balancer.

Target Group: Application Load Balancer routes requests to one or more registered targets (e.g., EC2 instances) using the protocol and port number configured by an organization.

Prerequisite

  • A VPC
  • 2 subnets in 2 availability zones (1 Public and 1 Private)
  • At least 1 Ec2 instances in each private zone, Install Httpd
  • 1 or 2 Nat Gateway for Httpd installation on Ec2

VPC Created as below

Application Load Balancer

Subnets in each Availability Zones

Application Load Balancer

Routes for public and Application subnets

Application Load Balancer

EC2 Instances in each availability zone.

Application Load Balancer

Steps to follow

  • Configure target group
  • Choose a Load balancer type
  • Configure your Load balancer and listener
  • Test your Load balancer

Configure Target Group

  • Navigate to Load balancer section under Ec2 console, click on create Target Group
  • Choose the target type as Instances, Provide a target group name and
  • Application Load Balancer

  • Choose the protocol as http and port as 80. Choose the VPC created before
  • Application Load Balancer

  • Keep rest field as default, click on next
  • Choose the Ec2 instances created before or wanted to use as a target
  • Application Load Balancer

  • Click on create Target group
  • Application Load Balancer

Choose a Load Balancer type

  • Navigate to Load balancer section under Ec2 console
  • Click on Application Load balancer
  • Application Load Balancer

Configure your Load balancer and listener

  • Provide a Name, Choose the scheme as internet-facing
  • Application Load Balancer

  • Select the VPC and subnets of each availability zones
  • Application Load Balancer

  • Choose the protocol as http and port as 80. Select the target group created before
  • Application Load Balancer

  • Keep rest all as default and click on create load balancer
  • Application Load Balancer

  • Verify the targets
  • Application Load Balancer

Test your Load balancer

Now the Load balancer has been provisioned with 2 healthy targets.
Now click on load balancer, pull out the DNS Name
DNS Name: ALB-demo-lb-890853269.ap-south-1.elb.amazonaws.com

Open any browser, hit the above DNS, You must receive the response from one of the Ec2 instances. ALB uses route robin method to route the traffic to targets.

Application Load Balancer

Keep on refreshing the browser, you will receive the response from other Ec2 instance as well.

Application Load Balancer

Conclusion

Load balancer is used to route the incoming internet traffic across the targets. The target can be instances, IP addresses, AWS Lambda, and ALB also. It provides scalability as well as high availability. For production workload and critical workload load balancers with multiple listeners are recommended. For 3 tier architecture load balancer is must recommended.

AWS for Beginners: How to Protect AWS Security Tools: Part 4
AWS for Beginners: What is IAM (Identity and Access Management) and Best Practices: Part 5
AWS for Beginners: Provisioning IAM Users and Programmatic Access in AWS: Part 6
AWS for Beginners: Securing Root account using MFA: Part 7
AWS for Beginners: Amazon S3 Overview, Security and Best Practices : Part 8
AWS for Beginners: Creating and managing IAM groups: Part 9
AWS for Beginners: AWS Managed Policies and In-line Policies: Part 10
AWS for Beginners: Create and Attach a policy to an IAM User: Part 11
AWS for Beginners: How to Create a Customer Managed Policy: Part 12
AWS for Beginners: What are EC2 Placement groups: Part 13
AWS for Beginners: ALB vs NLB vs GLB – Which AWS Load Balancer Should You Choose: Part 14
AWS for Beginners: What is AWS Elastic IP Address: Part 15
AWS for Beginners: How to add secondary IP to EC2 Instance using Elastic Network Interfaces (ENI): Part 16
AWS for Beginners: How to Enable Multi-Attach for Amazon EBS Volumes: Part 17

Follow our Twitter and Facebook feeds for new releases, updates, insightful posts and more.

Rate this post