Manage load balancers
A load balancer distributes traffic among pools according to pool health and traffic steering policies. Each load balancer is identified by its DNS hostname (lb.example.com
, dev.example.com
, etc.).
For more details about load balancers, refer to Load balancers.
Create a load balancer
To create a load balancer in the dashboard:
-
Go to Traffic > Load Balancing.
-
Select Create Load Balancer.
-
On the Hostname page:
- Enter a Hostname, which is the DNS name at which the load balancer is available. For more details on record priority, refer to DNS records for load balancing.
- Toggle the orange cloud icon to update the proxy mode, which affects how traffic is routed and which IP addresses are advertised.
- If you want session-based load balancing, toggle the Session Affinity switch.
-
Select Next.
-
On the Add a Pool page:
- Select one or more existing pools or create a new pool.
- If you are going to set traffic steering to Off, re-order the pools in your load balancer to adjust the fallback order.
- If needed, update the Fallback Pool.
- If you choose to set traffic steering to Random, you can set Weights (via the API) to your pools to determine the percentage of traffic sent to each pool.
-
Select Next.
-
On the Monitors page:
- Review the monitors attached to your pools.
- If needed, you can attach an existing monitor or create a new monitor.
-
Select Next.
-
On the Traffic Steering page, choose an option for Traffic steering and select Next.
-
On the Custom Rules page, select an existing rule or create a new rule.
-
Select Next.
-
On the Review page:
- Review your configuration and make any changes.
- Choose whether to Save as Draft or Save and Deploy.
For a full list of properties, refer to Create Load Balancer. If you need help with API authentication, refer to Cloudflare API documentation.
The response contains the complete definition of the new load balancer.
Sharing your load balancer with other sites
You can share your load balancer with other sites in your account by creating a canonical name (CNAME
) record. This is useful for sharing configurations with multiple other domains so you do not have to create new load balancers for each site.
You can also configure separate load balancers for each domain and reuse monitors and pools. This is especially useful for changing the failover order for different domains, such as when your example.co.uk
server has a different failover priority from example.com
or example.com.au
.
Edit a load balancer
To edit a load balancer in the dashboard:
- Go to Traffic > Load Balancing.
- On a specific load balancer, click Edit.
- While going through the creation workflow, update settings as needed.
- On the Review step, click Save.
When you edit a load balancer with the API, your request type depends on how much you want to edit.
To update specific settings without having to resubmit the entire configuration, use a PATCH request. For broader changes, use a PUT request.
Delete a load balancer
If you delete or disable a load balancer, your endpoint’s response to requests will depend on your existing DNS records.
To delete a load balancer in the dashboard:
- Go to Traffic > Load Balancing.
- On a specific load balancer, click Delete.
To delete a load balancer using the API, send a DELETE request.
Set up alerts
You can configure alerts to receive notifications for changes in the health status of your pools or endpoints.
Load Balancing Health Alert
Who is it for?Customers who want to be warned about changes in health status in their pools or origins.
Other options / filtersAvailable filters include:
- You can search for and add pools from your list of pools, as well as Include future pools (if all pools are selected).
- You can choose the trigger that fires the notification when the health status becomes unhealthy, healthy, or either unhealthy or healthy
- You can choose the trigger that fires the notification when the event source health status changes in pool, origin, or either pool or origin.
Purchase of Load Balancing.
What should you do if you receive one?Evaluate load balancing analytics to review changes in health status over time.
Refer to Cloudflare Notifications for more information on how to set up an alert.