Front-end Tutorials

Front-end Tutorials

HTMLCSSSassJavaScriptReactJS
CMS Tutorials

CMS Tutorials

WordPress
Tutorials expand

Exploring AWS Application Load Balancer

Posted in AWS Tutorial
Updated on Dec 29, 2023
By Mari Selvan
👁️ 35 - Views
⏳ 4 mins
💬 1 Comment
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:

📸 EC2 Instance Showcase

Please examine our EC2 instances.

  1. ReactJS: ReactJS is employed to render the website.
  2. NextJS: NextJS is employed to render the website.
AWS EC2 instance with 2 server running

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

  1. Open the AWS Management Console.

  2. In the "Find Services" search bar, type "Load Balancers" and select "Load Balancers" from the results and click on the Create Load Balancer button.

    Create Application Load Balancer

    Photo Credit to CodeToFun

  3. Now, Choose Application Load Balancer.

  4. Configure the Application Load Balancer Basic configuration as follows:

    1. Load balancer name: Name of your choice.
    2. Scheme: Internet-facing.
    3. IP address type: IPv4.
    AWS Application load balancer basic configuration

    Photo Credit to CodeToFun

  5. Configure the Application Load Balancer Network mapping as follows:

    1. VPC: Choose any VPC.
    2. 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).
    AWS Application Load Balancer Network Mapping

    Photo Credit to CodeToFun

  6. Configure the Application Load Balancer Security groups as follows.

    • Security groups: You can select up to 5 security groups.
    AWS Application Load Balancer Security Groups

    Photo Credit to CodeToFun

  7. Configure the Application Load Balancer Listeners and routing as follows.

    1. Lets configure for HTTP

      • Protocol: HTTP.
      • Port: 80.
      • Default action: Choose Your Target Group.
    2. 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.
    AWS Application Load Balancer Listeners and Routing

    Photo Credit to CodeToFun

  8. Now, click on the Create Load Balancer button.

    Create Application Load Balancer

    Photo Credit to CodeToFun

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

    AWS Application Load Balancer Status

    Photo Credit to CodeToFun

  10. When you load the copied DNS name for the first time it may serve ReactJS EC2 instance as follows.

    AWS Application Load Balancer Server ReactJS

    Photo Credit to CodeToFun

  11. Now, try to refresh the page, the application load balancer may serve the other NextJS EC2 instance as follows.

    AWS Application Load Balancer Server NextJS

    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:

To get interesting news and instant updates on Front-End, Back-End, CMS and other Frameworks. Please Join the Telegram Channel:

Author

author
👋 Hey, I'm Mari Selvan

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

Share Your Findings to All

Subscribe
Notify of
guest
1 Comment
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
Mari Selvan
Mari Selvan
3 months ago

If you have any doubts regarding this article (Exploring AWS Application Load Balancer), please comment here. I will help you immediately.

We make use of cookies to improve our user experience. By using this website, you agree with our Cookies Policy
AgreeCookie Policy