Learn how to remove a server instance from your Vultr Load Balancer configuration
Detaching an instance from a Vultr Load Balancer removes it from traffic distribution, allowing you to scale down or perform maintenance without affecting other instances. Before detaching, ensure that the instance is no longer needed for load balancing to prevent disruptions.
Follow this guide to attach an instance to a Vultr Load Balancer on your Vultr account using the Vultr Customer Portal, API, CLI, or Terraform.
+
icon, deselect the instance(s) to remove, and save.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 currently attached instance IDs.
$ 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, omitting the instance you want to detach.
$ 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": [
"<remaining_instance_1_id>",
"<remaining_instance_2_id>"
]
}'
Confirm the update with a GET
request:
$ curl "https://api.vultr.com/v2/load-balancers/{load-balancer-id}" \
-X GET \
-H "Authorization: Bearer ${VULTR_API_KEY}"
List all Load Balancers and note the target Load Balancer's ID.
$ vultr-cli load-balancer list
List all instances and note which ones are currently attached.
$ vultr-cli instance list
Detach an instance by omitting it from the --instances
flag in the update command.
$ vultr-cli load-balancer update <load-balancer-id> \
--instances "<remaining_instance_1_id>" "<remaining_instance_2_id>"
Confirm the update.
$ vultr-cli load-balancer get <load-balancer-id>
Open your Terraform configuration file for the existing Load Balancer.
Remove the target instance ID from the nodes
list.
resource "vultr_load_balancer" "lb" {
# ...existing fields (region, forwarding_rules, health_check, etc.)
nodes = [
vultr_instance.web1.id
# vultr_instance.web2.id (this instance is detached)
]
}
Apply the configuration and observe the following output:
Apply complete! Resources: 0 added, 1 changed, 0 destroyed.