Hi, everyone, and welcome back.
Now in today's video, we are going to discuss about the classic load balances practically.
Now at a high level overview, classic load balances is one of the older generation of load balances.
And in fact, this is one of the primary first load balancer type that was initially available after
classic load balancer.
Then multiple different load balancer types like application load balancer.
Network Load Balancer were released.
So classic load balancer, it provides basic set of features for HTTP, HTTPS as well as TCP as well
as SSL protocols.
So it can support all of these protocols.
But the feature sets that are associated with this is quite limited.
In case if you want to go ahead and have detailed set of features available, for example, for HTTP
https, then it's better to use the application load balancer which is dedicated for these type.
So at a high level overview, the practical that we are going to implement is will be creating a classic
load balancer.
This classic load balancer will be associated with two sets of ESI, two instances where our website
would be running, and then we'll look into how the load balancing would work.
So within our console, let's go ahead and first launch these two sets of ESI two instance where our
website would be running.
So I'll quickly launch two instances.
So number of instances here, I'll set it to two and the name, let's just call it as LP instances.
Let's go a bit down.
Within the keeper name, you can just associate the right keeper because you have to download and install
the web server inside DC too.
So once this is done, you can quickly go ahead and launch the instances here.
Great.
So at this stage we have two instances that are currently available.
Let's go ahead and quickly connect to both of them via SSDs.
So let's select the instance.
Number one, I'll copy the public IP and from the terminal, let's go ahead and add this IP address
and we are connected.
Similarly, let's copy the public IP of second instance and from a newer tab.
Let me add the IP address here.
And great, we are connected.
So let's quickly switch to the root user.
And once we are in the root user, let's run the install engine x command.
So it should give us the Amazon Linux Express command to install anything.
So I'll run this.
Let's paste it here.
It will ask you for confirmation.
I'll type Y and I'll press enter.
Let's try once more.
Great.
And our engine X is installed.
Once this is done, you can go ahead and do a system CTL, start engine X, and now if you do a system,
it's status engine X.
Over here you should see an engine x is running similarly in our first instance as well.
We'll run the sudo issue command to use the root user.
We'll run the Amazon Linux Express command to install the engine x.
Let's press y.
I'll press enter.
And once the engine X is installed, you can do a system.
So it'll start engine X to start the web server.
This web server that is running is associated with Port of 80.
So in case if you want to open the website, you have to allow Port eight in this specific instances
security group.
So what we'll do for the security group will add one more rule associated with the port of it.
So I'll edit the inbound rules here.
I'll add a new rule associated with a port of 80, and I'll allow 0000 over here and I'll click on Save.
Once this is done, let's go back to the instances and within here, let's copy the public IP of instance
one from a new tab.
Let me add the IP address here to verify website is loading and yes, the website is loading.
Similarly, let's also confirm the instance to IP and let me add it to warrior to verify website is
loading and yes, the website is loading.
Now one thing that we'll do to quickly identify in fact let's quickly go to user share engine X is HTML.
So when we open up the website that contains the HTML, contents are loaded from this specific file.
So I'll just say echo.
This is website one and I'll store it to index the HTML.
Similarly, we'll copy the same command.
Let's go to this specific folder and we'll say a code.
This is website two and I'll store it to index the HTML file.
Now if I refresh the page this time, you see it states this is website two and for the first step,
this time you see it states website one.
Great.
So at this stage are easy to instances are up and running with a specific website and now we can go
ahead and quickly create a new classic load balancer that will load balance the traffic between both
of these instances.
Now, let's quickly go to the load balancer section.
We'll create a new load balancer within the load balancer type.
Let's go a bit down.
I'll click on classic load balancer and within here we'll click on Create the Load Balancer name.
I'll just call it as demo CLB and you can select the VPC.
This is the default VPC.
I'll use the same thing.
The load balancer protocol is 80 and the instance protocol again is 80.
Now as we're discussing that this classic load balancer is supposed to be DPS, TCP as well.
If you'll see over here, there are multiple protocols that are available.
We'll be keeping things simple.
We'll use the HTTP protocol.
I'll click on next and within you can go ahead and select the security group if you'd like.
Let me click on create a new security group.
And within here you have to make sure that for Port 80 you have 0000 allowed one.
This is then let's do a next.
We'll do a next.
We'll add easy to instance and we'll select both of these easy two instances here.
Let's do a next.
I'll do a review and create and I'll click on Create Grid.
So if you see our demo, CLB is currently available and in order to connect to it, they have also provided
us with a URL.
Now if you look into the instances over here, there are two instances at this stage it is out of service.
This is completely fine.
Just give it a few minutes and both of the instances should change from out of service to in-service.
So let's quickly wait for a moment here.
And if I refresh again, you see, both of these instances are now in service, so now you can go ahead
and test things out.
So let me go ahead and copy the DNS name of a load balancer.
And from a newer tab, I'll add the DNS name over here.
And initially, the first request went to website two.
Let's refresh.
And now it went to website one.
Let's refresh again.
Website two, again, if you refresh website one and this is how the load balancing is currently working.
Similarly, let me also show you that in Curl.
I'll copy this.
Let's do a code on this load balancer here.
Again, if you don't have that is completely fine within your laptop.
I just wanted to show you on how that would look like in the ClA.
If I do call once more.
It went to website one.
Once I do it went to website two again.
If I do eight, went to website one.
All right.
So at this stage, we can confirm that our load balancer is working perfectly well and it's transferring
traffic to both of these instances.
Now, again, one thing to notice that sometimes when the load balancer is initialized, you might see
that when you send the traffic, it is only going to one server.
But just wait for a moment, maybe a minute or two, and then you can try and you will see the load
balancing to be working perfectly well.
Now one more thing is that after you have completed the practical, make sure that you delete the load
balancer, otherwise you'll unnecessarily be charged at the end of the month.
So let's go ahead and quickly do that.
Now, one more thing that I wanted to show you is that since these are a previous generation of load
balancers and are generally not recommended now you also have an option to migrate this previous generation
of load balancer to the next generation one.
So if you click on Migrate, now you have the ALB Migration Wizard where you can go ahead and migrate
to a specific load balancer type.
Again, let's go ahead and make sure that our resources are deleted so that you don't really get charged.
Primarily, the load balancer is something that you will get charged for, so I'll click on Delete.
Well, delete the load balancer and the instances also that you have created.
Make sure that you delete them within your environment after you have completed the practicals.
So this will conclude today's video.