How Do I Set Up a Load Balancer on DigitalOcean?
Distribute traffic across multiple Droplets with a DigitalOcean Load Balancer — improve uptime, handle traffic spikes, and simplify SSL.
What Does a Load Balancer Do?
A load balancer sits in front of your Droplets and distributes incoming requests across them. If one server fails, traffic routes to healthy ones automatically. You also get a stable IP address that never changes, even when you replace backend Droplets.
Step 1 — Create a Load Balancer
Go to Networking → Load Balancers → Create Load Balancer. Choose the same region as your Droplets — load balancers only route to Droplets in the same datacenter.
Step 2 — Configure Forwarding Rules
Set up how traffic enters and reaches your backends:
- Entry protocol/port: HTTPS on 443 (or HTTP on 80)
- Target protocol/port: HTTP on 80 (or your app's port like 3000)
The load balancer terminates SSL if you upload a certificate or use Let's Encrypt integration, then forwards plain HTTP to your Droplets internally.
Step 3 — Add Backend Droplets
Under Droplets, select the servers that will handle traffic. You can pick individual Droplets or apply by tag — e.g. tag two Droplets web and add the tag as a backend. New Droplets with that tag join the pool automatically.
Step 4 — Configure Health Checks
Health checks determine which backends receive traffic. Defaults usually work:
- Protocol: HTTP
- Path:
/(or a dedicated/healthendpoint) - Interval: 10 seconds
- Threshold: 3 failures to mark unhealthy, 5 successes to mark healthy
Build a simple health endpoint in your app that returns HTTP 200:
app.get('/health', (req, res) => res.sendStatus(200));
Step 5 — Point DNS at the Load Balancer
The load balancer gets its own IP address. Update your domain's A record to point at this IP instead of an individual Droplet. All traffic now flows through the balancer.
SSL on the Load Balancer
Under SSL, add a Let's Encrypt certificate for your domain. The load balancer handles HTTPS termination — your backend Droplets only need to serve HTTP on port 80.
When to Use a Load Balancer
- Running two or more Droplets for redundancy
- Expecting traffic spikes you cannot handle on one server
- Performing zero-downtime deploys by cycling Droplets in and out
At $12/month, a DigitalOcean Load Balancer is the simplest way to add high availability to your infrastructure.