
Before you begin
- Labs create a Google Cloud project and resources for a fixed time
- Labs have a time limit and no pause feature. If you end the lab, you'll have to restart from the beginning.
- On the top left of your screen, click Start lab to begin
Create a Dataproc cluster (region: us-central1)
/ 50
Submit a Spark Job
/ 25
Update a cluster for 5 worker nodes
/ 25
The Google APIs Explorer is a tool that helps you explore various Google APIs interactively. With the APIs Explorer, you can:
The APIs Explorer uses its own API key whenever it makes a request. When you use the APIs Explorer to make a request, it displays the request syntax, which includes a placeholder labeled {YOUR_API_KEY}. If you want to make the same request in your application, you need to replace this placeholder with your own API key.
In this lab, you'll learn how to use an inline Google APIs Explorer template to call the Cloud Dataproc API to create a cluster, then run a simple Spark job in the cluster. It also shows you how to use the APIs Explorer template to call the Cloud Dataproc API to update a cluster.
Read these instructions. Labs are timed and you cannot pause them. The timer, which starts when you click Start Lab, shows how long Google Cloud resources are made available to you.
This hands-on lab lets you do the lab activities in a real cloud environment, not in a simulation or demo environment. It does so by giving you new, temporary credentials you use to sign in and access Google Cloud for the duration of the lab.
To complete this lab, you need:
Click the Start Lab button. If you need to pay for the lab, a dialog opens for you to select your payment method. On the left is the Lab Details pane with the following:
Click Open Google Cloud console (or right-click and select Open Link in Incognito Window if you are running the Chrome browser).
The lab spins up resources, and then opens another tab that shows the Sign in page.
Tip: Arrange the tabs in separate windows, side-by-side.
If necessary, copy the Username below and paste it into the Sign in dialog.
You can also find the Username in the Lab Details pane.
Click Next.
Copy the Password below and paste it into the Welcome dialog.
You can also find the Password in the Lab Details pane.
Click Next.
Click through the subsequent pages:
After a few moments, the Google Cloud console opens in this tab.
Cloud Shell is a virtual machine that is loaded with development tools. It offers a persistent 5GB home directory and runs on the Google Cloud. Cloud Shell provides command-line access to your Google Cloud resources.
Click Activate Cloud Shell at the top of the Google Cloud console.
Click through the following windows:
When you are connected, you are already authenticated, and the project is set to your Project_ID,
gcloud
is the command-line tool for Google Cloud. It comes pre-installed on Cloud Shell and supports tab-completion.
Output:
Output:
gcloud
, in Google Cloud, refer to the gcloud CLI overview guide.
Go to Navigation menu > APIs & Services.
Scroll down the list until you find Cloud Dataproc API, and click on it.
Make sure that API is enabled, if not click Enable.
Now that you have verified the API's enablement, open Rest API Reference. This will open a new tab with the Rest API Reference page for the Cloud Dataproc API.
From the left APIs & Reference section navigate to REST reference > v1 > projects.regions.clusters > create to projects.regions.clusters.create
method or, to create cluster, use the Method: projects.regions.clusters.create reference.
Now you'll fill in the form and execute the APIs Explorer template, below, as follows:
clusterName
property. Enter the clusterName of your choice. Note, the value of the clusterName must not contain any uppercase letters or spaces.config
.gceClusterConfig
.zoneUri
field, then add the following, replacing my-project-id
with the Project ID for this lab:config
, select softwareConfig
.softwareConfig
, select imageVersion
and set it to 2.0-debian10
.softwareConfig
, select optionalComponents
. Under optionalComponents
click on ADD ITEM and select JUPYTER
from the dropdown.When you're done your Request body should look like this:
Make sure that there are no trailing spaces in any of the fields.
Now scroll down and click Execute.
Select the student account you started the lab with.
On the next screen, click Allow to give APIs Explorer access.
The results of the Dataproc API will appear below the Request and will look similar to the following:
Click Check my progress to verify your performed task. If you successfully created a Dataproc cluster in the
Next you'll run a simple Apache Spark job that calculates a rough value for pi in an existing Cloud Dataproc cluster.
projects.regions.jobs.submit
method or use this link to submit a job to a cluster.Now you'll fill in the form and execute the APIs Explorer template, below, as follows:
job
.placement
.clusterName
then type the name of your cluster.sparkJob
.args
. Under args
click on ADD ITEM and type 1000jarFileUris
. Under jarFileUris
click on ADD ITEM and type file:///usr/lib/spark/examples/jars/spark-examples.jar
mainClass
and type org.apache.spark.examples.SparkPi
When you're done your Request body should look like this:
The results of the Dataproc API will appear below the Request, and look similar to this:
You can find your results by going to Dataproc > Clusters. Click on the name of your cluster, then the Jobs tab.
Click on the Job ID and select Line Wrap to ON to bring the lines that exceed the right margin into view.
Click Check my progress to verify your performed task. If you successfully submit a Spark job to a cluster, you will see an assessment score.
projects.regions.clusters.patch
method or use this link to update a cluster.Now you'll fill in the form and execute the APIs Explorer template, below, as follows:
config
workerConfig
numInstances
, then type in 3.Your form should look like this:
The results of the Dataproc API will appear below the Request, and look similar to this:
Click Check my progress to verify your performed task. If you have successfully updated a worker config for 3 worker nodes you will see an assessment score.
Below are multiple choice questions to reinforce your understanding of this lab's concepts. Answer them to the best of your abilities.
You have used the Cloud Dataproc API through the API Explorer to create a cluster and run a Spark job, and update a cluster.
...helps you make the most of Google Cloud technologies. Our classes include technical skills and best practices to help you get up to speed quickly and continue your learning journey. We offer fundamental to advanced level training, with on-demand, live, and virtual options to suit your busy schedule. Certifications help you validate and prove your skill and expertise in Google Cloud technologies.
Manual Last Updated November 06, 2024
Lab Last Tested November 06, 2024
Copyright 2025 Google LLC All rights reserved. Google and the Google logo are trademarks of Google LLC. All other company and product names may be trademarks of the respective companies with which they are associated.