Update a Vultr cluster's label, hostname, and pool count to scale the cluster up or down by adjusting the desired and minimum pool size via the API.
Updating a cluster allows you to change its label, hostname, and pool size. Adjusting min_pool_count and desired_pool_count scales the cluster up or down by provisioning or removing instances automatically.
desired_pool_count must be equal to or greater than min_pool_count.
This guide explains how to update a cluster using the Vultr API.
Send a GET request to the List Clusters endpoint to retrieve all clusters.
$ curl "https://api.vultr.com/v2/clusters" \
-X GET \
-H "Authorization: Bearer ${VULTR_API_KEY}"
Note the id of the cluster you want to update.
Send a PUT request to the Update Cluster endpoint to update the cluster properties. Replace {cluster-id} with the cluster id. Include only the fields you want to change.
$ curl "https://api.vultr.com/v2/clusters/{cluster-id}" \
-X PUT \
-H "Authorization: Bearer ${VULTR_API_KEY}" \
-H "Content-Type: application/json" \
-d '{
"label": "NEW-LABEL",
"hostname": "NEW-HOSTNAME",
"min_pool_count": MIN-POOL-COUNT,
"desired_pool_count": DESIRED-POOL-COUNT
}'
A successful update returns an HTTP 202 Accepted response.
Send a GET request to the Get Cluster endpoint to retrieve the updated cluster details.
$ curl "https://api.vultr.com/v2/clusters/{cluster-id}" \
-X GET \
-H "Authorization: Bearer ${VULTR_API_KEY}"
Verify that the cluster details reflect the new values.