A Load Balancer distributes incoming traffic across multiple instances to improve performance, increase availability, and provide failover support. To function correctly, instances within the same geographic region must be attached to the Vultr Load Balancer.
Follow this guide to attach an instance to a Vultr Load Balancer on your Vultr account using the Vultr Customer Portal, API, or CLI.
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 GET
request to the List Instances endpoint and note your target instance's ID, ensuring it is in the same geographic region as the Load Balancer.
$ curl "https://api.vultr.com/v2/instances" \
-X GET \
-H "Authorization: Bearer ${VULTR_API_KEY}"
Send a PATCH
request to the Update Load Balancer endpoint to attach instances to the target Load Balancer.
$ 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 '{
"instances": [
"<instance_1_id>",
"<instance_2_id>"
]
}'
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
List all available instances and note your target instance's ID, ensuring it is in the same geographic region as the Load Balancer.
$ vultr-cli instance list
Update the target Load Balancer by attaching the new instances.
$ vultr-cli load-balancer update <load-balancer-id> --instances "<instance_1_id>" "<instance_2_id>" "<instance_3_id>"
Get the details of the target Load Balancer.
$ vultr-cli load-balancer get <load-balancer-id>