Create a Simple Application Load Balancer in AWS

Writing Code in Dim Office
Reading Time: 3 minutes

Hi all, today we are going to create a simple application load balancer in AWS. We will be going to use 2 windows server to achieve this. Our both windows server will be located in two different Availability zones(AZs).

Creating Ec2 Instances on AWS

First we have to create 2 servers(Windows Server) in two different Availability Zones. I have created it in us-east-1a and us-east-1b as shown in below image

Install a Remote Desktop Client

I am using Linux Based Personal System so if you are using in the same way please follow this step else if you are using windows in your personal system you can download the rdp(remote desktop file) file and connect using that only.

Before connecting using rdp file you have to upload your key.

on the same screen as above image click on Get password

Now browse your pem file and decrypt your password. Save it somewhere

Configure local Server

Now, we are going to configure our web server and then add our html file in it.

Click on Server Manager located on task bar

Click on add roles and features

Now, click on next until the below image appears. Choose web server(iis) on select server roles window.

Click on Add Features then click on next and finally install it.

Close it once it has been installed.

Creating Web Page

Now we will be going to create a simple web page(index.html).

Go to File Explorer -> Local Disk(C) -> Inetpub -> wwwroot

There you will find two files. Delete both of them and then create on text file on same location.

Feed something on that page which will be shown on internet.

Save the file with name index.html

Creating Target Group for Load Balancer

Now, before creating Load Balancer we have to create our target group first. We will be going to use target of type “instance”

Name your target group. And let other field as it is.

Finally register your targets

Creating Application Load Balancer

Now, we will be doing our final step.

Select Application Load balancer. Name your ALB. Fill details such as internet facing, ipv4 , target group name, protocol(i am using only http), Availability zones(where your instances are located), Security group

After it gets provisioned and all targets are healthy you can finally test it.

Copy of application load balancer dns and paste it over browser. refresh it after some time. random refreshing will balance its load to our two servers.

Conclusion

In this blog we have created a simple application load balancer using two windows server located in different AZs(Availability Zones). We have configured our web server and created web page on both servers. We have created Target group and finally application load balancer to balance the load to our both servers.

Visit https://docs.aws.amazon.com/elasticloadbalancing/latest/application/introduction.html for more details.

Visit https://blog.knoldus.com/technology/aws/ for more blogs on AWS

Leave a Reply