Learn how to select and configure the traffic distribution methods for your Vultr Load Balancer
A Load Balancing algorithm determines how a Vultr Load Balancer distributes incoming traffic to linked instances. Vultr Load Balancers support the Least Connections and Round Robin algorithms that manage the distribution of traffic to instances depending on your application needs.
Follow this guide to manage load balancing algorithms on a Vultr Load Balancer using the Vultr Customer Portal, API, CLI, or Terraform.
Navigate to Products and click Load Balancers.
Click your target Load Balancer to open its management page.
In Details, click the pencil icon to edit and manage the Algorithm.
Click Save changes to apply the Load Balancing algorithm.
Send a GET
request to the List Load Balancers endpoint and note the target Load Balancer's ID.
$ curl "https://api.vultr.com/v2/load-balancers" \
-X GET \
-H "Authorization: Bearer ${VULTR_API_KEY}"
Send a PATCH
request to the Update Load Balancer endpoint to update the target Load Balancer's algorithm.
$ curl "https://api.vultr.com/v2/load-balancers/{load-balancer-id}" \
-X PATCH \
-H "Authorization: Bearer ${VULTR_API_KEY}" \
-H "Content-Type: application/json" \
--data '{
"balancing_algorithm": "{roundrobin_or_leastconn}"
}'
Send a GET
request to the Get Load Balancer endpoint to fetch the details of the target Load Balancer.
$ curl "https://api.vultr.com/v2/load-balancers/{load-balancer-id}" \
-X GET \
-H "Authorization: Bearer ${VULTR_API_KEY}"
List all available instances and note the target Load Balancer's ID.
$ vultr-cli load-balancer list
Update the target Load Balancer's algorithm.
$ vultr-cli load-balancer update <load-balancer-id> --balancing-algorithm "<roundrobin_or_leastconn>"
Get the details of the target Load Balancer.
$ vultr-cli load-balancer get <load-balancer-id>
Open your Terraform configuration for the existing Load Balancer.
Update the balancing_algorithm
field in the configuration.
resource "vultr_load_balancer" "lb" {
# ...existing fields (region, label, health_check, etc.)
balancing_algorithm = "leastconn"
}
Apply the configuration and observe the following output:
Apply complete! Resources: 0 added, 1 changed, 0 destroyed.
No comments yet.