AWS Basic
- AWS Intro
- Launch EC2 Instance
- Elastic IP
- AWS Target Group
- AWS Application Load Balancer
- AWS Route53
- Amazon Certificate Manager
- Redirect HTTP to HTTPs
- Redirect WWW to Non WWW
- AWS Cloudfront
- Download S3 to Local
- Install Node.js & NPM in EC2
AWS Connection
AWS Wordpress
AWS Deploy App
Exploring AWS Application Load Balancer
Photo Credit to CodeToFun
🙋 Introduction
Amazon Web Services (AWS) Application Load Balancer (ALB) is a service that automatically distributes incoming application traffic across multiple targets, such as Amazon EC2 instances, in one or more Availability Zones.
ALB serves as a crucial component in building scalable, fault-tolerant, and highly available applications.
In this tutorial, we'll focus on setting up an AWS Application Load Balancer, assuming you've already configured a target group with EC2 instances.
📚 Prerequisites
Before proceeding, make sure you have the following:
- An AWS account with access to the EC2 service.
- An existing target group with at least two EC2 instances.
📸 EC2 Instance Showcase
Please examine our EC2 instances.
- ReactJS: ReactJS is employed to render the website.
- NextJS: NextJS is employed to render the website.
Photo Credit to CodeToFun
I deliberately perform this action to demonstrate how the Application Load Balancer distributes traffic among them.
Upon finishing this tutorial, you will possess a comprehensive understanding of how an application load balancer operates.
🛠️ Creating Application Load Balancer
Open the AWS Management Console.
In the "Find Services" search bar, type "Load Balancers" and select "Load Balancers" from the results and click on the Create Load Balancer button.
Photo Credit to CodeToFun
Now, Choose Application Load Balancer.
Configure the Application Load Balancer Basic configuration as follows:
- Load balancer name: Name of your choice.
- Scheme: Internet-facing.
- IP address type: IPv4.
Photo Credit to CodeToFun
Configure the Application Load Balancer Network mapping as follows:
- VPC: Choose any VPC.
- Mappings: Kindly choose a minimum of two regions, making certain that one of the selected regions aligns with the EC2 instance you intend to target (e.g., us-east-1a, us-east-1b).
Photo Credit to CodeToFun
Configure the Application Load Balancer Security groups as follows.
- Security groups: You can select up to 5 security groups.
Photo Credit to CodeToFun
Configure the Application Load Balancer Listeners and routing as follows.
Lets configure for HTTP
- Protocol: HTTP.
- Port: 80.
- Default action: Choose Your Target Group.
If you possess a domain name, it is necessary to set up HTTPs as well.
- Protocol: HTTPs.
- Port: 443.
- Default action: Choose Same Target Group as like HTTP.
Photo Credit to CodeToFun
Now, click on the Create Load Balancer button.
Photo Credit to CodeToFun
Navigate to the load balancer dashboard and wait until the status of your load balancer becomes Active. Once it's active, copy the DNS name and open the URL in any browser of your choice.
Photo Credit to CodeToFun
When you load the copied DNS name for the first time it may serve ReactJS EC2 instance as follows.
Photo Credit to CodeToFun
Now, try to refresh the page, the application load balancer may serve the other NextJS EC2 instance as follows.
Photo Credit to CodeToFun
Note: If your Application Load Balancer is not directing traffic to another EC2 instance, please refresh it at least 5 times to verify if it is functioning properly
🎉 Conclusion
Congratulations! You've successfully set up an AWS Application Load Balancer and configured it to distribute traffic to your EC2 instances.
ALB plays a crucial role in enhancing the availability and scalability of your applications.
Remember to adjust security groups, configure health checks, and monitor your ALB as your application scales.
👨💻 Join our Community:
Author
For over eight years, I worked as a full-stack web developer. Now, I have chosen my profession as a full-time blogger at codetofun.com.
Buy me a coffee to make codetofun.com free for everyone.
Buy me a Coffee
If you have any doubts regarding this article (Exploring AWS Application Load Balancer), please comment here. I will help you immediately.