← Back to list

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

Hi! Join me doing this 100 days of Cloud (AWS). Here’s the link: https://engineer.kodekloud.com/signup?referral=672847e178f19b9ad872e222

Rhea Mae Bibay · 2026-04-07 22:12 · 0 claps · 2.3 min read
#application-load-balancer #kodekloud #load-balancer
Open on Medium ↗
Wiki topics: ☁️ · DevOps & Cloud 🏆 · Sports · General

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

Hi! Join me doing this 100 days of Cloud (AWS). Here’s the link: https://engineer.kodekloud.com/signup?referral=672847e178f19b9ad872e222

Purpose

To configure an Application Load Balancer (ALB) in front of an EC2 instance running Nginx, enabling public HTTP access and proper traffic routing.

Architecture

Client (Internet)
        │
        ▼
Application Load Balancer (devops-alb)
        │
        ▼
Target Group (devops-tg)
        │
        ▼
EC2 Instance (devops-ec2 running Nginx)

Create Security Group for ALB

  1. Go to EC2 Dashboard → Security Groups
  2. Click Create Security Group
  3. Configure:
  • Name: nautilus-sg
  • Description: Allow HTTP access
  • Inbound Rules:
  • Type: HTTP
  • Port: 80
  • Source: 0.0.0.0/0 (public access)

Create Target Group

  1. Go to EC2 Dashboard → Target Groups
  2. Click Create Target Group
  3. Configure:
  • Target type: Instances
  • Name: nautilus-tg
  • Protocol: HTTP
  • Port: 80
  1. Click Next

  2. Register targets:

  • Select nautilus-ec2
  • Click Include as pending below

Create Application Load Balancer

  1. Go to EC2 Dashboard → Load Balancers
  2. Click Create Load Balancer → Application Load Balancer
  3. Configure:
  • Name: nautilus-alb
  • Scheme: Internet-facing
  • IP type: IPv4
  • Listeners: HTTP (Port 80)
  1. Select:
  • VPC: Same as EC2
  • Subnets: At least 2 public subnets same as EC2
  1. Under Security Groups:
  • Attach nautilus-sg
  1. Under Listeners and Routing:
  • Forward to nautilus-tg

Verify EC2 Security Group

  1. Go to EC2 → Instances → nautilus-ec2
  2. Check attached Security Group
  3. Ensure Inbound Rule exists:
  • Type: HTTP
  • Port: 80
  • Source: 0.0.0.0/0 OR ALB security group (nautilus-sg)

Validate Setup

  1. Copy ALB DNS Name

http://nautilus-alb-901417625.us-east-1.elb.amazonaws.com/

  1. Open in browser:

  2. Expected result:

  • Nginx default page is displayed

Insights:

Application Load Balancer (ALB) is used to route user requests to healthy servers.

In this lab, only one EC2 instance is used, so the ALB simply forwards traffic to that single server. However, the ALB’s DNS name is still used as the main entry point (front door) for users.

This setup is important because:

  • Additional EC2 instances can be added later without changing the DNS
  • The ALB automatically distributes traffic to healthy instances
  • Users will not experience downtime during scaling or instance failure, since traffic is redirected to available servers

메타데이터
post_id
fed31fd6eefe
slug
day-24-setting-up-an-application-load-balancer-for-an-ec2-instance-fed31fd6eefe
url
https://medium.com/@rheamae.b.acc/day-24-setting-up-an-application-load-balancer-for-an-ec2-instance-fed31fd6eefe
canonical_url
https://medium.com/@rheamae.b.acc/day-24-setting-up-an-application-load-balancer-for-an-ec2-instance-fed31fd6eefe
author_url
https://medium.com/@rheamae.b.acc
status
ok
fetched_at
2026-06-09 15:37:30