How to Create Load Balancers

DigitalOcean Load Balancers are a fully-managed, highly available network load balancing service. Load balancers distribute traffic to groups of Droplets, which decouples the overall health of a backend service from the health of a single server to ensure that your services stay online.

Setting up a load balancer is a two step process: creating the load balancer and then choosing Droplets for its backend pool.

Start by creating a load balancer using the Create button at the top of the control panel. Alternatively, use the Create load balancer button on the Load Balancers overview page.

Create menu

On the creation page, you will:

  1. Choose a size. Your load balancer’s size determines the maximum number of simultaneous connections it can maintain, how many requests per second it can manage, and its overall cost per month.

  2. Choose a datacenter region. Your load balancer and its backend Droplets need to be in the same datacenter, so choose the region where your Droplets are or will be located.

  3. In the VPC Network section, choose a VPC network for the load balancer. You can choose one you’ve created or use your default network for the datacenter region. VPC networking enables an additional networking interface that can only be accessed by other resources within the same VPC network. This keeps traffic between Droplets and other applicable resource from being routed outside the datacenter over the public internet.

We began the incremental release of DigitalOcean VPC on 7 April, 2020. It will be available for all customers soon. The VPC service replaces the Private Networking service.
  1. Add forwarding rules. Forwarding rules define how traffic is routed from the load balancer to its backend Droplets. You need at least one rule.

    The default route is HTTP port 80 on the load balancer to HTTP port 80 on the backend Droplets. You can create new rules during creation with the New Rule drop-down. After creation, you can modify a load balancer’s rules at any time on its Settings page.

  2. Set advanced settings. Advanced settings allow you to modify additional parameters for the load balancer, like its balancing algorithm, sticky sessions, health checks, SSL forwarding, and PROXY protocol. You can also modify these settings after you create the load balancer. Learn more about advanced settings.

  3. Finalize and create, which includes Choose a name and Select project. Load balancer names must be unique and contain alphanumeric characters, dashes, and periods only. You can rename load balancers at any time after creation by clicking on the existing name on the load balancer page.

After you create the load balancer, you’ll be brought to the load balancer’s detail page where you can add Droplets to it. Click Choose Droplets to open the Add Droplets window.

Add Droplets by tag window

You can add individual Droplets or you can choose a tag. You can only choose Droplets that are in the same region as the load balancer, and if you use a tag, only tagged Droplets in the same region as the load balancer will be part of its backend. You can use one tag per load balancer.

When you’ve selected the tag or Droplets, click Add Droplets. When you add Droplets to a load balancer, the Droplets start in a DOWN state and remain in a DOWN state until they pass the load balancer’s health check. Once the backends have passed the health check the required number of times, they will be marked healthy and the load balancer will begin forwarding requests to them.

Once you have at least one load balancer, you can view and manage them on the load balancer index page.

The load balancer index page

Clicking on a load balancer from the index page takes you to its detail page. On the detail page, you can manage and customize the load balancer by modifying its backend Droplet pool, viewing its performance graphs, and changing advanced settings.