Elastic Load Balancer

Hands-On

Demo

In this demo, we will:

  1. Create a VPC with two public subnets
  2. Launch two EC2 instances with a basic web server
  3. Create a security group for the EC2 instances
  4. Create an Application Load Balancer
  5. Configure the ALB target group
  6. Test the load balancer
  7. Clean up resources

Agenda

Demo Overview

Create VPC

ELB-Demo-VPC

VPC Settings

Create VPC workflow

Launch an EC2 instance

ELB-Demo-Instance-1

Key pair

Network settings

#!/bin/bash
yum update -y
yum install -y httpd
systemctl start httpd
systemctl enable httpd
echo "<h1>Hello from $(hostname -f)</h1>" > /var/www/html/index.html

User data

Launch 2nd instance

ELB-Demo-Instance-2

Network settings

#!/bin/bash
yum update -y
yum install -y httpd
systemctl start httpd
systemctl enable httpd
echo "<h1>Hello from $(hostname -f)</h1>" > /var/www/html/index.html

User data

Create load balancer

Application Load Balancer

ELB-Demo-ALB

Network mapping

Create security group

ELB-Demo-ALB-SG
Allow HTTP traffic from anywhere

Inbound rules

Outbound rules

Create security group

Select Security groups

Create target group

ELB-Demo-TG

Target Group Settings

Register targets

Review targets

Listeners and routing

Summary

Create load balancer

Modify EC2 Security Group to Allow Incoming Traffic from ALB

Add inbound rule

Final Result

Test

Copy ALB DNS Name 

Paste in Browser with http:// prefixed

Refresh a few times 

Notice the hostname changing

Clean Up

Delete load balancer

Delete Target Group 

Terminate (delete) EC2 instances

Delete security group

Delete VPC

🙏

Thanks

for

Watching

Elastic Load Balancer - Hands-On Demo

By Deepak Dubey

Elastic Load Balancer - Hands-On Demo

Elastic Load Balancer - Hands-On Demo

  • 145