Skip to content

Get started with Load Balancer

View as Markdown

Put an external Application Load Balancer (ALB) in front of a website on one of your nodes, then open the website through the load balancer’s own public IP. Once this works, adding more servers or HTTPS is a change to the same load balancer.

You need:

  • A node in Delhi or Chennai that reads Running, in the region where you will create the load balancer. See Get started with Node.
  • A website on the node that listens on its private IP, on a port you know, such as 80, and answers a HEAD request for / with a success or redirect status, such as 200 OK or 301. A website that listens only on localhost is out of the load balancer’s reach. The load balancer checks the node this way and sends traffic only while the check passes.
  • A security group on the node that allows inbound TCP on the website’s port. See Add or edit rules.
  • Enough balance or infra credits for the plan you choose. See Your balance cannot cover the plan.
  • Create permission for Load Balancers in the project.

To check the website the way the load balancer will, sign in to the node and run this command. <node-private-ip> is the node’s private IP, shown in the nodes list, and <port> is the website’s port:

curl -I -H "Host: localhost" http://<node-private-ip>:<port>/

The first line shows the status. A status in the 200s or 300s means the node will pass the check:

HTTP/1.1 200 OK
  1. In MyAccount, under Compute, click Load Balancers. Click +, or Get Started if you have no load balancer yet.

  2. On Plan, click a plan. The table lists each plan’s vCPU, RAM, Max Concurrent Connections, and Price per hour and per month. Start with the smallest plan, E2E-LB-2, with 4 vCPU and 6 GB RAM. On hourly billing, you can move to a larger plan later, after you power off the load balancer.

    If every plan shows Request in place of Select, see Every plan shows Request in place of Select.

  3. Under —Choose Hourly / Committed LB—, choose Hourly Billed, and click Next.

  1. On Type, click Application Load Balancer (ALB). The next step opens.
  2. On Details, keep the suggested Name, or enter your own.
  3. Keep Scheme on External (with public IP) - Distributes traffic from external sources.
  4. Set Frontend Protocol to HTTP. The load balancer then listens on port 80, and needs no certificate. Click Next.

On Target Mapping, keep the starting values: Backend Protocol on HTTP, Health Check ticked, Routing Policy on Source IP Hash, and Backend Type on Node.

  1. Beside Backend Servers, click Add Server.
  2. In Server Name, start typing the node’s name, and pick the node. Server IP fills in. Check that it is the node’s private IP, the address the load balancer reaches the node on.
  3. In Server Port, enter the website’s port, and click Submit. The node joins Backend Servers.
  4. Click Next.
  1. On Peak Performance Features, keep the defaults. Under Security Group, your project’s default security group is chosen. Check that its rules allow inbound TCP on port 80 from your users, or choose another group that does; see Add or edit rules. Click Next.
  2. On Summary, check your choices, and click Launch Load Balancer.

MyAccount returns you to the Load Balancers list, where your load balancer reads Creating. With Frontend Protocol on HTTP, as here, it reads Running about four to seven minutes after you launch it.

If it reads Backend Connection Failure instead, check the node with the steps in The load balancer shows Backend Connection Failure.

Open your website through the load balancer

Section titled “Open your website through the load balancer”

In the Load Balancers list, copy the load balancer’s Public IP. Open this address in a browser, where <load-balancer-ip> is that IP:

http://<load-balancer-ip>/

Your website opens, served by your node through the load balancer. To see the server’s health, click the load balancer in the list and open its Backend Mapping tab, which lists your server with its IP and port.

(Optional) Point your domain at the load balancer

Section titled “(Optional) Point your domain at the load balancer”

To reach the website by name, add an A record for your domain at your DNS provider, with the load balancer’s Public IP as its value. Once the record is live, open your domain over http://.

A load balancer is billed by the minute from when you create it until you delete it, and also while it is powered off. When you have finished trying it, delete it; see Delete a load balancer. Your node is a separate product with its own charges.