Stay organized with collections
Save and categorize content based on your preferences.
Update a Dataproc cluster by using a template
This page shows you how to use an Google APIs Explorer template to
update a Dataproc cluster to change the number of workers in a
cluster. Scaling a cluster
up to include more workers is a common task when additional workers are needed
to process larger jobs.
Specify the region
where your cluster is located (confirm or replace "us-central1").
Your cluster's region is listed on the
Dataproc Clusters
page in the Google Cloud console.
Specify the clusterName
of the existing cluster that you are updating (confirm or replace "example-cluster").
updateMask:
"config.worker_config.num_instances". This is the JSON PATH
relative to the Cluster
resource to the numInstances parameter to be updated (see the Request body instructions).
Request body:
config.workerConfig.numInstances:
("3": the new number of workers). You can change this value to add fewer
or more workers. For example, if your standard cluster has the default
number of 2 workers, specifying "3" will add 1 worker; specifying "4 will add 2).
A standard Dataproc cluster must have at least 2 workers.
Click EXECUTE. The first time you
run the API template, you may be asked to choose and sign into
your Google account, then authorize the Google APIs Explorer to access your
account. If the request is successful, the JSON response
shows that cluster update is pending.
To confirm that the number of workers in the cluster has been updated,
open the Dataproc
Clusters page in the Google Cloud console
and view the cluster's Total worker nodes column. You may need
to click REFRESH at the top of the page to view the updated value after the
cluster update completes.
Clean up
To avoid incurring charges to your Google Cloud account for
the resources used on this page, follow these steps.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-25 UTC."],[[["\u003cp\u003eThis guide details how to update a Dataproc cluster's worker count using the Google APIs Explorer template.\u003c/p\u003e\n"],["\u003cp\u003eUpdating the worker count is done through the \u003ccode\u003econfig.workerConfig.numInstances\u003c/code\u003e parameter, where you can specify the desired number of workers.\u003c/p\u003e\n"],["\u003cp\u003eBefore making an update, you must specify your project ID, the region of your cluster, and the name of the existing cluster to modify.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eupdateMask\u003c/code\u003e parameter with a value of "config.worker_config.num_instances" is required to successfully update the worker count.\u003c/p\u003e\n"],["\u003cp\u003eAfter executing the update, you can confirm the change by checking the "Total worker nodes" column on the Dataproc Clusters page.\u003c/p\u003e\n"]]],[],null,["# Quickstart: Update a Dataproc cluster by using a template\n\nUpdate a Dataproc cluster by using a template\n=============================================\n\nThis page shows you how to use an [Google APIs Explorer](https://developers.google.com/apis-explorer/#p/) template to\nupdate a Dataproc cluster to change the number of workers in a\ncluster. [Scaling a cluster](/dataproc/docs/concepts/configuring-clusters/scaling-clusters)\nup to include more workers is a common task when additional workers are needed\nto process larger jobs.\n\nFor other ways to update a Dataproc cluster, see:\n\n- [Create a Dataproc cluster by using the Google Cloud console](/dataproc/docs/quickstarts/create-cluster-console#update_a_cluster)\n- [Create a Dataproc cluster by using the Google Cloud CLI](/dataproc/docs/quickstarts/create-cluster-gcloud#update_a_cluster)\n- [Create a Dataproc cluster by using client libraries](/dataproc/docs/quickstarts/create-cluster-client-libraries)\n\nBefore you begin\n----------------\n\nThis quickstart assumes you have already created a Dataproc cluster. You can use the [APIs Explorer](/dataproc/docs/quickstarts/create-cluster-template), the [Google Cloud console](/dataproc/docs/quickstarts/update-cluster-console#create_a_cluster), the gcloud CLI [gcloud](/dataproc/docs/quickstarts/update-cluster-gcloud#create_a_cluster) command-line tool, or the [Quickstarts using Cloud Client Libraries](/dataproc/docs/quickstarts/create-cluster-client-libraries) to create a cluster.\n\n\u003cbr /\u003e\n\nUpdate a cluster\n----------------\n\nTo update the number of workers in your cluster, fill in and execute the\nGoogle APIs Explorer **Try this API** template.\n| **Note:** The `region`, `clusterName` and `updateMask` and `config.workerConfig.numInstances` parameter values are filled in for you. Confirm or replace the `region` and`clusterName` parameter values to match your cluster's region and name. The `updateMask` parameter value is required to update the number of workers in your cluster. You can accept or change the `config.workerConfig.numInstances` parameter value.\n\n1. **Request parameters:**\n\n 1. Insert your [**projectId**](https://console.cloud.google.com/).\n 2. Specify the [**region**](/compute/docs/regions-zones/regions-zones#available) where your cluster is located (confirm or replace \"us-central1\"). Your cluster's region is listed on the Dataproc [**Clusters**](https://console.cloud.google.com/dataproc/clusters) page in the Google Cloud console.\n 3. Specify the [**clusterName**](/dataproc/docs/reference/rest/v1/projects.regions.clusters/patch#body.PATH_PARAMETERS.cluster_name) of the existing cluster that you are updating (confirm or replace \"example-cluster\").\n 4. [**updateMask**](/dataproc/docs/reference/rest/v1/projects.regions.clusters/patch): \"config.worker_config.num_instances\". This is the JSON PATH relative to the [Cluster](/dataproc/docs/reference/rest/v1/projects.regions.clusters#resource:-cluster) resource to the `numInstances` parameter to be updated (see the Request body instructions).\n2. **Request body:**\n\n 1. [**config.workerConfig.numInstances**](/dataproc/docs/reference/rest/v1/ClusterConfig#InstanceGroupConfig.FIELDS.num_instances): (\"3\": the new number of workers). You can change this value to add fewer or more workers. For example, if your standard cluster has the default number of 2 workers, specifying \"3\" will add 1 worker; specifying \"4 will add 2). A standard Dataproc cluster must have at least 2 workers.\n3. Click **EXECUTE**. The first time you\n run the API template, you may be asked to choose and sign into\n your Google account, then authorize the Google APIs Explorer to access your\n account. If the request is successful, the JSON response\n shows that cluster update is pending.\n\n4. To confirm that the number of workers in the cluster has been updated,\n open the Dataproc\n [Clusters](https://console.cloud.google.com/dataproc/clusters) page in the Google Cloud console\n and view the cluster's **Total worker nodes** column. You may need\n to click REFRESH at the top of the page to view the updated value after the\n cluster update completes.\n\nClean up\n--------\n\n\nTo avoid incurring charges to your Google Cloud account for\nthe resources used on this page, follow these steps.\n\n1. If you don't need the cluster to explore the other quickstarts or to run other jobs, use the [APIs Explorer](/dataproc/docs/quickstarts/quickstart-explorer-delete), the [Google Cloud console](/dataproc/docs/quickstarts/update-cluster-console#delete_a_cluster), the gcloud CLI [gcloud](/dataproc/docs/quickstarts/update-cluster-gcloud#delete_a_cluster) command-line tool, or the [Quickstarts using Cloud Client Libraries](/dataproc/docs/quickstarts/create-cluster-client-libraries) to delete the cluster.\n\nWhat's next\n-----------\n\n- You can use this quickstart template to restore the cluster to its previous\n `workerConfig.numInstances` value.\n\n- Learn how to [write and run a Spark Scala job](/dataproc/docs/tutorials/spark-scala)."]]