Skip to content

Commit c2b813c

Browse files
mikeCRLjhlodin
andauthored
Add section to CC API doc on updating resources for Advanced clusters (#19541)
* Add section to API doc on updating resources Advanced clusters * Chris F feedback --------- Co-authored-by: Joe Lodin <[email protected]>
1 parent fc43d7d commit c2b813c

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed

src/current/cockroachcloud/cloud-api.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -585,6 +585,50 @@ 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. The API endpoint spawns a job to handle the change in resources. The duration of this job can vary depending on the amount of storage and the cloud provider.
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+
--json '{
600+
"spec": {
601+
"dedicated": {
602+
"hardware": {
603+
"machine_spec": {
604+
"num_virtual_cpus": 8
605+
}
606+
}
607+
}
608+
}
609+
}'
610+
~~~
611+
612+
To change the number of nodes in a region:
613+
614+
{% include_cached copy-clipboard.html %}
615+
~~~ shell
616+
curl --request PATCH \
617+
--url https://cockroachlabs.cloud/api/v1/clusters/{cluster_id} \
618+
--header 'Authorization: Bearer {secret_key}' \
619+
--json '{
620+
"spec": {
621+
"dedicated": {
622+
"region_nodes": {
623+
"us-east-1": 5
624+
}
625+
}
626+
}
627+
}'
628+
~~~
629+
630+
Where `{cluster_id}` is the ID of your cluster and `{secret_key}` is your API key.
631+
588632
## Change a cluster's plan
589633

590634
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)