Hosted in Lagos: servers from ₦10 an hour, Spaces from ₦6,750 a month →
Docs menu

Docs / Networking

Create a load balancer

7 minute read

A load balancer spreads traffic across two or more of your servers and stops sending to any that fail their health check. It has its own public IPv4 address in Lagos and can serve HTTPS with a certificate we issue and renew for you.

1. Create it

Open Load balancers → Create load balancer: name it, add forwarding rules, pick the servers (or a tag), set the health check and create. It is ready in a minute or two; its address is shown from the start, so you can point your domain at it straight away.

simplicloud load-balancers create web-lb \
--rule http:80:http:8080 \
--rule https:443:http:8080:cert=www.korafoods.ng \
--target web-1 --target web-2 \
--health http:8080:/healthz --redirect-https on
✓ web-lb is active at 203.0.113.20

Each load balancer takes a public IPv4 address from the same pool as reserved addresses. If none is free, creating one is refused with a message saying so; nothing is half made.

2. Forwarding rules

A rule says what the load balancer listens on and where it sends it on your servers. Up to 10 rules, one per entry port.

EntryTargetUse it for
HTTPHTTP, HTTPS or HTTP/2Websites and APIs; adds X-Forwarded-For and X-Forwarded-Proto
HTTPS or HTTP/2HTTP, HTTPS or HTTP/2The load balancer holds the certificate and decrypts
HTTPS with TLS passthroughHTTPSYour servers hold the certificate; traffic stays encrypted to them
TCPTCPAnything else: databases, message queues, game servers

3. HTTPS certificates

For an HTTPS rule, name a domain that is on your Domains & DNS. We add an A record pointing it at the load balancer and get a free certificate for it, renewed automatically before it expires. The Rules tab shows when it is issued. The certificate is checked over port 80, so port 80 must be free or an HTTP rule.

Your domain is managed somewhere else? Use TLS passthrough and keep the certificate on your servers, or move the domain to SimpliCloud's nameservers first.

4. Targets and tags

Targets are servers in the load balancer's project. Pick them by name, or name a tag: every server with that tag is a target, including servers you tag later. Tag servers on their Settings tab or with the CLI:

Terminal
simplicloud servers tag web-3 web
simplicloud load-balancers health web-lb
SERVER IP HEALTH DETAIL
web-1 172.30.4.10 healthy
web-2 172.30.4.11 healthy
web-3 172.30.4.12 unhealthy Layer4 connection problem

Traffic reaches your servers from the load balancer's private address in the project network. The visitor's address is in the X-Forwarded-For header (HTTP rules) or the PROXY header (below).

5. Health checks

  • Protocol HTTP, HTTPS or TCP, on any port; HTTP checks ask for a path (for example /healthz) and pass on a 2xx or 3xx answer.
  • Interval and timeout from 3 to 300 seconds (defaults 10 and 5).
  • A server is healthy after 5 passing checks in a row and unhealthy after 3 failures by default; both are adjustable from 2 to 10.

6. Sticky sessions, redirect, PROXY protocol

  • Sticky sessions: a cookie (name and lifetime of your choice) sends a visitor back to the same server.
  • Redirect HTTP to HTTPS: visitors on http:// get a permanent redirect; needs an HTTPS rule on port 443.
  • PROXY protocol: passes the visitor's address in a PROXY v2 header. Turn it on only if your servers expect it (nginx: listen 80 proxy_protocol;).

The detail page shows requests and connections since the load balancer last started, and the health of each target.

7. Billing and limits

A load balancer is billed by the hour while it exists, its public IPv4 included. It costs ₦14,600 a month (₦20 an hour, plus VAT); the console shows the current price before you create one. An organisation can have three; ask support for more.

Was this page helpful?

Related guides