Vultr Load Balancer efficiently distributes incoming traffic across multiple servers, ensuring balanced resource utilization and enhanced reliability. This service prevents individual servers from becoming overloaded by managing traffic evenly, which helps maintain application performance and uptime. By provisioning a Load Balancer, you can enhance the scalability and resilience of your applications, improving overall user experience.
Follow this guide to provision a Vultr Load Balancer on your Vultr account using the Vultr Customer Portal, API, or CLI.
Navigate to Products and click Load Balancers.
Click Add Load Balancer.
Choose a Load Balancer Location.
Provide a Label, select an Algorithm, set the Timeout, and choose the number of Nodes. The default algorithm is Round Robin.
Configure additional settings:
Configure Forwarding Rules to define how the Load Balancer routes traffic.
Optional: Select a VPC Network. By default the VPC network is set to Public.
Optional: Configure Firewall rules to control inbound and outbound traffic.
Configure Health Checks to monitor backend node availability. Set the Protocol (HTTP, HTTPS, or TCP), Port, and other parameters like Interval, Timeout, and Thresholds to determine when a node is marked as healthy or unhealthy.
Click Add Load Balancer.
Send a GET
request to the List Regions endpoint and note your target region ID.
$ curl "https://api.vultr.com/v2/regions" \
-X GET \
-H "Authorization: Bearer ${VULTR_API_KEY}"
Send a POST
request to the Create Load Balancer endpoint to provision a Load Balancer.
$ curl "https://api.vultr.com/v2/load-balancers" \
-X POST \
-H "Authorization: Bearer ${VULTR_API_KEY}" \
-H "Content-Type: application/json" \
--data '{
"region" : "{region_id}",
"balancing_algorithm" : "{roundrobin_or_leastconn}",
"ssl_redirect" : false,
"http2": false,
"http3": false,
"proxy_protocol" : false,
"timeout" : {timeout_in_seconds},
"label" : "{label}",
"nodes" : {number_of_nodes},
"health_check" : {
"protocol" : "{http_or_https_or_tcp}",
"port" : {port},
"path" : "/health",
"check_interval" : {interval_in_seconds},
"response_timeout" : {timeout_in_seconds},
"unhealthy_threshold" : {unhealthy_threshold},
"healthy_threshold" : {healthy_threshold}
},
"forwarding_rules": [
{
"frontend_protocol" : "{http_or_https_or_tcp}",
"frontend_port" : {frontend_port_number},
"backend_protocol" : "{http_or_https_or_tcp}",
"backend_port" : {backend_port_number}
}
],
"firewall_rules": [
{
"port" : {allowed_port_number},
"source" : "{source_ip_cidr}",
"ip_type" : "{v4_or_v6}"
}
],
"auto_ssl": {
"domain_zone" : "{your_domain}",
"domain_sub" : "{subdomain}"
}
}'
Visit the Create Load Balancer page to view additional attributes you can include in your request.
Send a GET
request to the List Load Balancers endpoint to list all the available Load Balancers.
$ curl "https://api.vultr.com/v2/load-balancers" \
-X GET \
-H "Authorization: Bearer ${VULTR_API_KEY}"
List all Vultr regions and note the target region ID.
$ vultr-cli regions list
Create a Load Balancer.
$ vultr-cli load-balancer create \
--region "<region_id>" \
--balancing-algorithm "<roundrobin_or_leastconn>" \
--ssl-redirect false \
--proxy-protocol false \
--response-timeout <timeout_in_seconds> \
--label "<label>" \
--nodes <number_of_nodes> \
--protocol "<http_or_https_or_tcp>" \
--port <port> \
--path "/health" \
--check-interval <interval_in_seconds> \
--healthy-threshold <healthy_threshold> \
--unhealthy-threshold <unhealthy_threshold> \
--forwarding-rules "frontend_protocol:<http_or_https_or_tcp>,frontend_port:<frontend_port_number>,backend_protocol:<http_or_https_or_tcp>,backend_port:<backend_port_number>" \
--firewall-rules "port:<allowed_port_number>,ip_type:<v4_or_v6>,source:<source_ip_cidr>"
Run vultr-cli load-balancer create --help
to view additional options you can apply when creating a Load Balancer.
List all the available Load Balancers.
$ vultr-cli load-balancer list
No comments yet.