fbpx Skip to content

Tips on setting up an AWS classic load balancer (CLB)

*Please download resources before you proceed with the steps.

In AWS, Elastic Load Balancer(ELB) routes traffic from inbound applications to many destinations, including Amazon EC2 instances, containers, IP addresses, and Lambda functions. In a single availability zone or  several availability zones helps you to regulate the variable load of your application’s traffic. Elastic Load Balancing provides three types of load balancers – Application Load balancer(ALB), Network Load Balancer(NLB), and Classic Load Balancer(CLB) which provides  the high availability, automated scalability, and security required to make your applications error-tolerant. Here we will learn about Classic load Balancer and how to implement it in AWS.

Classic Load Balancer ( CLB )

The Classic Load Balancer operates at both the request and connection levels and provides basic load balancing in many Amazon EC2 instances. It’s intended for use with EC2-Classic-based applications. CLB gives you benefits in the following ways:-

  • Provides Support to TCP and SSL listeners.
  • Support to Sticky Session.
  • Support to EC2- Classic.
 

Steps to create EC2 instances for CLB:-

  1. Open AWS Management Console and search EC2.
  2. Click on Instances in the left sidebar.

image 1

3.  Click on Launch Instances.

image 2

4.  In Step 1: Choose AMI, select Amazon Linux 2 AMI (HVM), SSD Volume Type.

image3

5.  In Step 2: Choose an Instance Type, select t2 micro (free tier eligible) and then next.

image 4

6. In Step 3: Configure Instance details, give number of instances as 2.

image5

7. In User Data, add or copy/paste the code for your application to run and click next.

image6

8. Skip to Step 5: Add Tags, select Add Tags and give key and its value. Click Next.

image7

9 .  In Step 6: Configure Security Groups, give a unique Security Group Name and description. Click on Add Rule and select HTTP from the dropdown menu. In source, choose custom or anywhere to make the application visible to everyone from anywhere.

Click on Review and Launch.image8

10 .  In Step 7: Review Instance Launch, click Launch and then Launch Instances.image9

In Instances section you can see the 2 instances created. You can try running these applications by copying their          public IPv4 addresses in the browser.

Your application would look like this:-

Now, we will create a Classic Load Balancer (CLB) and connect it with  both of these application servers.

Steps to create Classic Load Balancer(CLB):-

  1. In EC2 dashboard, click on Load Balancers in the left sidebar.

image10

2.  Click on Create Load Balancer and then in Select Load Balancer Type, click Create under Classic Load        Balancer.image11

3.  In Step 1: Define Load Balancer, give CLB a unique name, leave all other settings as default and click Next.image12

4.  In Step 2: Assign Security Groups, create a new Security Group and give it a name and description. Add HTTP         protocol to it and then click Next.image113

5.  Skip to Step 4. In Advanced Details, set Interval time as 10 seconds. Click Next.image14

6.  In Step 5: Add EC2 Instances, select all the instances you want to add in the load balancer.image15

7.  In Step 7, Review and Create the Classic Load Balancer. Click Create.

You have successfully created your first Classic Load Balancer. To check it’s working, you first need to check                  your all the instances are working.image16

To access your application using CLB, copy and paste the DNS name from the description to the new browser               and run it. You can observe getting responses from different IPs by refreshing the page after every 10 seconds.image17

Your applications output will look like:-image18image19

You can observe 2 different IPs being accessed using the same link( DNS name).

Congratulations! You have configured how to use Classic Load Balancer.

No comment yet, add your voice below!


Add a Comment

Your email address will not be published. Required fields are marked *

Interview Preparation Questions

Category : Quiz
Open chat
1
Expert Guidance?
ThinkCloudly
Hello, how can we help you?