Elastic Load Balancer Setup (Application Load Balancer)

Hello and welcome! 

In this guide we are going to set up a load balancer with AWS EC2. This service falls in the free tier so you can use it to your heart’s content. Well not really. You have 750 hours monthly and can use Classic and Application Load Balancers with limited bandwidth in the free tier, but hey, you’ll probably not need more than that!

Let’s go ahead and do some load balancing!

Head over to Services > EC2. Scroll down on the sidebar to see the Load Balancing section. Click on Load Balancers. Here you can click on Create Load Balancer.

You now have 3 options. Application Load Balancer, Network Load Balancer and Classic Load Balancer. Notice how the Classic Load Balancer is gray. You can get more details about the types of Load Balancers in our Elastic Load Balancers article. Let’s select Application Load Balancer.

Here we can enter a name for the Load Balancer and decide whether it is internet facing or internal. You can also select the protocol and the port number (since this is an Application Load Balancer) to listen on.

You also need to select Availability Zones where the Load Balancer will send traffic. If you want it to send traffic to all of them, check all.

Since I’m using HTTP and not using HTTPS, I get this warning. If you’re using HTTPS you won’t see it. Click Next: Configure Security Groups.

We can select our security group here. You can simply use the security group that you assigned to the server. Click on Next: Configure Routing.

We can now create a target group and give it a name. We can choose to go with instance by ids, IP addresses or even Lambda functions. Let go with instance. Click Next: Register Targets.

Here we’ll see a list of our instances and registered targets. You can select instances below and add them to registered targets.

Once you have selected your targets, go ahead and click Next: Review.

You can review the details and if satisfied, go ahead and click Create.

You’ll then see a success message. Click on Close.

It will take some time to set up. Leave it for a few minutes then click the refresh icon. You should see that the status has changed to active.

Now if you scroll down and copy the DNS Name in the Base Configuration below, and paste it in the browser, it should open up the web page hosted on the EC2 server.

This is the page that we had created in the EC2 HTTP Server guide.

Alright, my work is done here. If you have any questions, shoot them in the comments. Thanks for taking the time to read my article, see you in the next one! Bye 👋