APIs Explorer Quickstart—Update a cluster

This page shows you how to use an inline Google APIs Explorer template to update a Cloud Dataproc cluster to change the number of workers in a cluster. You can learn how to do the same task using the Google Cloud Platform Console in Quickstart Using the Console or using the command line in Quickstart using the gcloud command-line tool.

Before you begin

This quickstart assumes you have already created a Cloud Dataproc cluster. You can use the APIs Explorer, the Google Cloud Platform Console, or the GCP SDK gcloud command-line tool to create a cluster.

Update a cluster

To update the number of workers in your cluster, fill in and execute the APIs Explorer template, below, as follows:

  1. Enter you project ID (project name) in the projectID field.
  2. The following fields are filled in for you:

    1. region = a "global". global is the default region when a Cloud Dataproc cluster is created. This is a special multi-region namespace that is capable of deploying instances into all Compute Engine zones globally when a Cloud Dataproc cluster is created. If you created your cluster (see APIs Explorer—Create a cluster) in a different region, replace "global" with the name of your cluster's region.
    2. clusterName = "example-cluster". This is the name of the Cloud Dataproc cluster (created in the previous quickstarts—see APIs Explorer—Create a cluster) that will be updated. Replace this name with the name of your cluster if it is different.
    3. updateMask = "config.worker_config.num_instances". This is the query parameter's JSON PATH relative to the cluster. This parameter specifies the number of worker instances in a cluster(see next item).
    4. Patch body config.workerConfig.numInstances = "5". This sets (updates) the number of workers in the cluster.
  3. Click EXECUTE. A dialog will ask you to confirm the default https://www.googleapis.com/auth/cloud-platform scope. Click the dialog's ALLOW to send the request to the service. After less than one second (typically), the JSON response showing that the example-cluster is pending appears below the template.

You can confirm that the number of workers in the cluster has been updated by going to GCP Console—Clusters.

Congratulations! You've used the Google APIs Explorer to update a Cloud Dataproc cluster.

Clean up

To avoid incurring charges to your Google Cloud Platform account for the resources used in this quickstart:

  1. If you plan on using the cluster, you can use the above template to restore the cluster to it default configuration with two workers (in the Patch body field, change numInstances to "2", fill in the projectID, then click Authorize and Execute).

  2. If you don't need the cluster, use the APIs Explorer, the Google Cloud Platform Console, or the Cloud SDK gcloud command-line tool to delete a cluster.

  3. If you delete your cluster, you should also remove any Cloud Storage buckets that were created by the cluster. To do this, run the following command:

    gsutil rm gs://bucket/subdir/**

What's next

Was this page helpful? Let us know how we did:

Send feedback about...

Cloud Dataproc Documentation