Skip to main content

Command Palette

Search for a command to run...

Day 24: Setting Up an Application Load Balancer for an EC2 Instance

Updated
3 min read
Day 24: Setting Up an Application Load Balancer for an EC2 Instance
A

"I'm a 3rd-year Computer Engineering student at Marwadi University with skills in C++, web development (MERN stack), and DevOps tools like Kubernetes. I contribute to open-source projects and share tech knowledge on GitHub and LinkedIn. I'm learning cloud technologies and app deployment. As an Internshala Student Partner, I help others find jobs and courses." now currently focusing on #90DaysOfDevops

Introduction

During Day 24 of the KodeKloud 100 Days of Cloud Challenge, I worked on setting up an AWS Application Load Balancer (ALB) for an EC2 instance running an Nginx web server.

Application Load Balancers are commonly used in AWS to distribute incoming traffic across backend resources. Instead of exposing EC2 instances directly to users, organizations place an ALB in front of their applications to improve availability, scalability, and traffic management.

In this lab, the goal was to create an Application Load Balancer, configure a Target Group, and route HTTP traffic to an EC2 instance.

AWS Application Load Balancer Setup Requirements

The task requirements were:

  • Create an Application Load Balancer named devops-alb

  • Create a Target Group named devops-tg

  • Create a Security Group named devops-sg

  • Allow HTTP traffic on port 80

  • Attach the Security Group to the ALB

  • Route traffic from the ALB to the devops-ec2 instance

  • Verify that the EC2 instance receives traffic successfully

Step 1: Navigate to Load Balancers

I opened the EC2 console and selected Load Balancers from the left navigation menu. From there, I clicked Create Load Balancer to begin the configuration process.

Step 2: Select Application Load Balancer

AWS provides multiple load balancer options. For this task, I selected Application Load Balancer (ALB) since it is designed to handle HTTP and HTTPS traffic efficiently.

Step 3: Configure the Load Balancer

Next, I configured the basic settings for the load balancer and provided the required name:

devops-alb

I kept the scheme as Internet-facing and configured the listener to use HTTP on port 80.

Step 4: Create a Security Group for the Application Load Balancer

The first step was creating a Security Group named devops-sg.

To allow public access to the application, I configured an inbound rule:

Type Port Source
HTTP 80 0.0.0.0/0

This Security Group was later attached to the Application Load Balancer.

Step 5: Create the Target Group

Next, I created a Target Group named devops-tg.

Configuration used:

  • Target Type: Instance

  • Protocol: HTTP

  • Port: 80

After creating the Target Group, I registered the devops-ec2 instance as a target.

Step 7: Verify the Load Balancer

Once all configurations were completed, AWS successfully created the Application Load Balancer.

After the target passed the health checks, the load balancer became active and ready to route traffic to the EC2 instance.

Step 8: Test the Application Load Balancer

Finally, I copied the DNS name of the Application Load Balancer and opened it in a browser.

The Nginx sample page loaded successfully, confirming that traffic was being routed correctly from:

User → Application Load Balancer → Target Group → EC2 Instance

Conclusion

Day 24 provided hands-on experience with setting up an AWS Application Load Balancer for an EC2 instance.

Although the application was a simple Nginx web server, the architecture followed the same pattern commonly used in production environments. Understanding how ALBs, Target Groups, and Security Groups work together is an important skill for anyone working with AWS and cloud infrastructure.

100 Days Of Cloud (AWS)

Part 1 of 21

This series documents my 100 Days of Cloud journey with AWS using KodeKloud. Each blog covers one daily task with hands-on practice, simple explanations, and real learning for beginners and cloud aspirants.

Up next

AWS Day 23: Migrating Data Between S3 Buckets Using AWS CLI | KodeKloud 100 Days of Cloud

Introduction During Day 23 of the KodeKloud 100 Days of Cloud Challenge, I worked on a practical data migration task using Amazon S3 and AWS CLI. Data migration is a common activity in cloud environme

More from this blog

A

Anand Raval

120 posts

I'm Anand Raval, a Cloud & DevOps Engineer with AWS Solutions Architect Associate (SAA-C03), Certified Kubernetes Administrator (CKA), and Azure Fundamentals (AZ-900) certifications. This blog covers AWS, Kubernetes, Terraform, CI/CD, cloud architecture, automation, cost optimization, troubleshooting guides, and hands-on DevOps projects.