Lab Information
The Nautilus DevOps team is currently working on setting up a simple application on the AWS cloud. They aim to establish an Application Load Balancer (ALB) in front of an EC2 instance where an Nginx server is currently running. While the Nginx server currently serves a sample page, the team plans to deploy the actual application later.
Set up an Application Load Balancer named devops-alb.
Create a target group named devops-tg.
Create a security group named devops-sg to open port 80 for the public.
Attach this security group to the ALB.
The ALB should route traffic on port 80 to port 80 of the devops-ec2 instance.
Make appropriate changes in the default security group attached to the EC2 instance if necessary.
Lab Solutions
π§ Step-by-Step Solution
πΉ STEP 1: Create Security Group for ALB (devops-sg)
Go to EC2 β Security Groups
Click Create security group
Set:
Security group name: devops-sg
Description: ALB security group
VPC: Default VPC
Inbound rules β Add rule
Type: HTTP
Port: 80
Source: 0.0.0.0/0
Leave Outbound rules as default
Click Create security group
β This allows public internet traffic to the ALB.
πΉ STEP 2: Create Target Group (devops-tg)
Go to EC2 β Target Groups
Click Create target group
Configure:
Target type: Instances
Target group name: devops-tg
Protocol: HTTP
Port: 80
VPC: Default VPC
Health checks
Protocol: HTTP
Path: / (default, works with Nginx)
Click Next
Select devops-ec2
Port: 80
Click Include as pending
Click Create target group
πΉ STEP 3: Create Application Load Balancer (devops-alb)
Go to EC2 β Load Balancers
Click Create load balancer
Choose Application Load Balancer
Basic configuration
Name: devops-alb
Scheme: Internet-facing
IP address type: IPv4
Network mapping
VPC: Default VPC
Availability Zones: Select at least 2 subnets
Security groups
Remove default SG
Select devops-sg
Listeners & routing
Listener: HTTP : 80
Forward to: devops-tg
Click Create load balancer
πΉ STEP 4: Update EC2 Security Group (VERY IMPORTANT)
Your EC2 instance must allow traffic from the ALB, otherwise it will fail health checks.
Go to EC2 β Instances
Select devops-ec2
Click its Security Group
Edit inbound rules
Add rule:
Type: HTTP
Port: 80
Source: Security group
Select: devops-sg
β Do NOT leave it open to 0.0.0.0/0 unless the lab allows it
β
Best practice is ALB β EC2 only
Save rules.
πΉ STEP 5: Verify Everything Works
1οΈβ£ Check Target Group Health
EC2 β Target Groups β devops-tg
Targets should show Healthy
2οΈβ£ Access the ALB
EC2 β Load Balancers β devops-alb
Copy DNS name, e.g.:
devops-alb-30750798.us-east-1.elb.amazonaws.com
Open in browser:
http://
β You should see the Nginx welcome page





Top comments (0)