Skip to content

Commit 251f78f

Browse files
authored
Add section to API doc on updating resources Advanced clusters
1 parent db793ad commit 251f78f

File tree

1 file changed

+46
-0
lines changed

1 file changed

+46
-0
lines changed

src/current/cockroachcloud/cloud-api.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -585,6 +585,52 @@ If the request was successful, the API returns the updated cluster details.
585585

586586
For details about returned fields, refer to the [response example and schema](https://www.cockroachlabs.com/docs/api/cloud/v1.html#patch-/api/v1/clusters/-cluster_id-) in the API reference.
587587

588+
## Change the resources for a CockroachDB Advanced cluster
589+
590+
To change the hardware specifications (e.g., number of vCPUs or number of nodes) for a CockroachDB Advanced cluster, use the `/v1/clusters/{cluster_id}` endpoint with the `PATCH` method.
591+
592+
For example, to change the number of vCPUs per node to 8:
593+
594+
{% include_cached copy-clipboard.html %}
595+
~~~ shell
596+
curl --request PATCH \
597+
--url https://cockroachlabs.cloud/api/v1/clusters/{cluster_id} \
598+
--header 'Authorization: Bearer {secret_key}' \
599+
--header 'Content-Type: application/json' \
600+
--json '{
601+
"spec": {
602+
"dedicated": {
603+
"hardware": {
604+
"machine_spec": {
605+
"num_virtual_cpus": 8
606+
}
607+
}
608+
}
609+
}
610+
}'
611+
~~~
612+
613+
To change the number of nodes in a region:
614+
615+
{% include_cached copy-clipboard.html %}
616+
~~~ shell
617+
curl --request PATCH \
618+
--url https://cockroachlabs.cloud/api/v1/clusters/{cluster_id} \
619+
--header 'Authorization: Bearer {secret_key}' \
620+
--header 'Content-Type: application/json' \
621+
--json '{
622+
"spec": {
623+
"dedicated": {
624+
"region_nodes": {
625+
"us-east-1": 5
626+
}
627+
}
628+
}
629+
}'
630+
~~~
631+
632+
Where `{cluster_id}` is the ID of your cluster and `{secret_key}` is your API key.
633+
588634
## Change a cluster's plan
589635

590636
This section shows how to change a cluster's plan using the CockroachDB {{ site.data.products.cloud }} API. To use Terraform instead, refer to [Provision a cluster with Terraform]({% link cockroachcloud/provision-a-cluster-with-terraform.md %}#change-a-clusters-plan).

0 commit comments

Comments
 (0)