Stay organized with collections
Save and categorize content based on your preferences.
Run a managed notebooks instance on a Dataproc cluster
This page shows you how to run a managed notebooks instance's
notebook file on a Dataproc cluster.
Before you begin
Sign in to your Google Cloud account. If you're new to
Google Cloud,
create an account to evaluate how our products perform in
real-world scenarios. New customers also get $300 in free credits to
run, test, and deploy workloads.
In the Google Cloud console, on the project selector page,
select or create a Google Cloud project.
To ensure that the service account has the necessary
permissions to run a notebook file on a Dataproc Serverless cluster,
ask your administrator to grant the service account the
following IAM roles:
These predefined roles contain
the permissions required to run a notebook file on a Dataproc Serverless cluster. To see the exact permissions that are
required, expand the Required permissions section:
Required permissions
The following permissions are required to run a notebook file on a Dataproc Serverless cluster:
dataproc.agents.create
dataproc.agents.delete
dataproc.agents.get
dataproc.agents.update
dataproc.tasks.lease
dataproc.tasks.listInvalidatedLeases
dataproc.tasks.reportStatus
dataproc.clusters.use
Your administrator might also be able to give the service account
these permissions
with custom roles or
other predefined roles.
Create a Dataproc cluster
To run a managed notebooks instance's notebook file
in a Dataproc cluster, your cluster must meet the following
criteria:
Next to your managed notebooks instance's name,
click Open JupyterLab.
Run a notebook file in your Dataproc cluster
You can run a notebook file in your Dataproc cluster
from any managed notebooks instance in the same project and
region.
Run a new notebook file
In your managed notebooks instance's JupyterLab interface,
select File >
New > Notebook.
Your Dataproc cluster's available kernels appear in
the Select kernel menu. Select the kernel that you want to use,
and then click Select.
Your new notebook file opens.
Add code to your new notebook file, and run the code.
To change the kernel that you want to use
after you've created your notebook file, see the following section.
Run an existing notebook file
In your managed notebooks instance's JupyterLab interface,
click the
folderFile Browser button,
navigate to the notebook file that you want to run, and open it.
To open the Select kernel dialog, click the kernel name of your notebook
file, for example: Python (Local).
To select a kernel from your Dataproc cluster,
select a kernel name that includes your cluster name at the end of it.
For example, a PySpark kernel on a Dataproc cluster
named mycluster is named PySpark on mycluster.
Click Select to close the dialog.
You can now run your notebook file's code
on the Dataproc cluster.
[[["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."],[],[],null,["# Run a managed notebooks instance on a Dataproc cluster\n======================================================\n\n\n| Vertex AI Workbench managed notebooks is\n| [deprecated](/vertex-ai/docs/deprecations). On\n| April 14, 2025, support for\n| managed notebooks will end and the ability to create managed notebooks instances\n| will be removed. Existing instances will continue to function\n| but patches, updates, and upgrades won't be available. To continue using\n| Vertex AI Workbench, we recommend that you\n| [migrate\n| your managed notebooks instances to Vertex AI Workbench instances](/vertex-ai/docs/workbench/managed/migrate-to-instances).\n\n\u003cbr /\u003e\n\nThis page shows you how to run a managed notebooks instance's\nnotebook file on a Dataproc cluster.\n\nBefore you begin\n----------------\n\n- Sign in to your Google Cloud account. If you're new to Google Cloud, [create an account](https://console.cloud.google.com/freetrial) to evaluate how our products perform in real-world scenarios. New customers also get $300 in free credits to run, test, and deploy workloads.\n- In the Google Cloud console, on the project selector page,\n select or create a Google Cloud project.\n\n | **Note**: If you don't plan to keep the resources that you create in this procedure, create a project instead of selecting an existing project. After you finish these steps, you can delete the project, removing all resources associated with the project.\n\n [Go to project selector](https://console.cloud.google.com/projectselector2/home/dashboard)\n-\n [Verify that billing is enabled for your Google Cloud project](/billing/docs/how-to/verify-billing-enabled#confirm_billing_is_enabled_on_a_project).\n\n-\n\n\n Enable the Notebooks and Dataproc APIs.\n\n\n [Enable the APIs](https://console.cloud.google.com/flows/enableapi?apiid=notebooks.googleapis.com,dataproc)\n\n- In the Google Cloud console, on the project selector page,\n select or create a Google Cloud project.\n\n | **Note**: If you don't plan to keep the resources that you create in this procedure, create a project instead of selecting an existing project. After you finish these steps, you can delete the project, removing all resources associated with the project.\n\n [Go to project selector](https://console.cloud.google.com/projectselector2/home/dashboard)\n-\n [Verify that billing is enabled for your Google Cloud project](/billing/docs/how-to/verify-billing-enabled#confirm_billing_is_enabled_on_a_project).\n\n-\n\n\n Enable the Notebooks and Dataproc APIs.\n\n\n [Enable the APIs](https://console.cloud.google.com/flows/enableapi?apiid=notebooks.googleapis.com,dataproc)\n\n1. If you haven't already, [create\n a managed notebooks instance](/vertex-ai/docs/workbench/managed/create-instance#create).\n\n### Required roles\n\n\nTo ensure that the service account has the necessary\npermissions to run a notebook file on a Dataproc Serverless cluster,\n\nask your administrator to grant the service account the\nfollowing IAM roles:\n\n| **Important:** You must grant these roles to the service account, *not* to your user account. Failure to grant the roles to the correct principal might result in permission errors.\n\n- [Dataproc Worker](/iam/docs/roles-permissions/dataproc#dataproc.worker) (`roles/dataproc.worker`) on your project\n- [Dataproc Editor](/iam/docs/roles-permissions/dataproc#dataproc.editor) (`roles/dataproc.editor`) on the cluster for the `dataproc.clusters.use` permission\n\n\nFor more information about granting roles, see [Manage access to projects, folders, and organizations](/iam/docs/granting-changing-revoking-access).\n\n\nThese predefined roles contain\n\nthe permissions required to run a notebook file on a Dataproc Serverless cluster. To see the exact permissions that are\nrequired, expand the **Required permissions** section:\n\n\n#### Required permissions\n\nThe following permissions are required to run a notebook file on a Dataproc Serverless cluster:\n\n- ` dataproc.agents.create `\n- ` dataproc.agents.delete `\n- ` dataproc.agents.get `\n- ` dataproc.agents.update `\n- ` dataproc.tasks.lease `\n- ` dataproc.tasks.listInvalidatedLeases `\n- ` dataproc.tasks.reportStatus `\n- ` dataproc.clusters.use`\n\n\nYour administrator might also be able to give the service account\nthese permissions\nwith [custom roles](/iam/docs/creating-custom-roles) or\nother [predefined roles](/iam/docs/roles-overview#predefined).\n\nCreate a Dataproc cluster\n-------------------------\n\nTo run a managed notebooks instance's notebook file\nin a Dataproc cluster, your cluster must meet the following\ncriteria:\n\n- The cluster's component gateway must be enabled.\n\n- The cluster must have\n the [Jupyter component](/dataproc/docs/concepts/components/jupyter).\n\n- The cluster must be in the same region as\n your managed notebooks instance.\n\nTo create your Dataproc cluster,\nenter the following command in either\n[Cloud Shell](https://console.cloud.google.com?cloudshell=true) or another\nenvironment where the [Google Cloud CLI](/sdk/docs) is installed. \n\n```bash\ngcloud dataproc clusters create CLUSTER_NAME\\\n --region=REGION \\\n --enable-component-gateway \\\n --optional-components=JUPYTER\n```\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003eREGION\u003c/var\u003e: the Google Cloud location of\n your managed notebooks instance\n\n- \u003cvar translate=\"no\"\u003eCLUSTER_NAME\u003c/var\u003e: the name of your new\n cluster\n\nAfter a few minutes, your Dataproc cluster\nis available for use. [Learn more about creating Dataproc\nclusters](/dataproc/docs/guides/create-cluster).\n\nOpen JupyterLab\n---------------\n\n1. If you haven't already,\n [create\n a managed notebooks instance](/vertex-ai/docs/workbench/managed/create-instance#create) in the same region\n where your Dataproc cluster is.\n\n2. In the Google Cloud console, go to the **Managed notebooks** page.\n\n [Go to Managed notebooks](https://console.cloud.google.com/vertex-ai/workbench/managed)\n3. Next to your managed notebooks instance's name,\n click **Open JupyterLab**.\n\nRun a notebook file in your Dataproc cluster\n--------------------------------------------\n\nYou can run a notebook file in your Dataproc cluster\nfrom any managed notebooks instance in the same project and\nregion.\n\n### Run a new notebook file\n\n1. In your managed notebooks instance's JupyterLab interface,\n select **File \\\u003e\n New \\\u003e Notebook**.\n\n2. Your Dataproc cluster's available kernels appear in\n the **Select kernel** menu. Select the kernel that you want to use,\n and then click **Select**.\n\n Your new notebook file opens.\n3. Add code to your new notebook file, and run the code.\n\nTo change the kernel that you want to use\nafter you've created your notebook file, see the following section.\n\n### Run an existing notebook file\n\n1. In your managed notebooks instance's JupyterLab interface,\n click the\n folder **File Browser** button,\n navigate to the notebook file that you want to run, and open it.\n\n2. To open the **Select kernel** dialog, click the kernel name of your notebook\n file, for example: **Python (Local)**.\n\n3. To select a kernel from your Dataproc cluster,\n select a kernel name that includes your cluster name at the end of it.\n For example, a PySpark kernel on a Dataproc cluster\n named `mycluster` is named **PySpark on mycluster**.\n\n4. Click **Select** to close the dialog.\n\n You can now run your notebook file's code\n on the Dataproc cluster.\n\nWhat's next\n-----------\n\n- Learn more about [Dataproc](/dataproc/docs/concepts/overview)."]]