使用 Google Cloud 控制台创建笔记本

了解如何使用 Google Cloud 控制台创建 Colab Enterprise 笔记本并在默认运行时中运行其代码。本页面还介绍了如何重命名、导入和删除笔记本。


如需在 Google Cloud 控制台中直接遵循有关此任务的分步指导,请点击操作演示

操作演示


准备工作

  1. 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.
  2. In the Google Cloud console, on the project selector page, select or create a Google Cloud project.

    Go to project selector

  3. Make sure that billing is enabled for your Google Cloud project.

  4. Enable the Vertex AI, Dataform, and Compute Engine APIs.

    Enable the APIs

  5. In the Google Cloud console, on the project selector page, select or create a Google Cloud project.

    Go to project selector

  6. Make sure that billing is enabled for your Google Cloud project.

  7. Enable the Vertex AI, Dataform, and Compute Engine APIs.

    Enable the APIs

所需的角色

如需确保您的用户账号具有创建 Colab Enterprise 笔记本并在运行时运行笔记本代码所需的权限,请让您的管理员为您的用户账号授予项目的 Colab Enterprise User (roles/aiplatform.colabEnterpriseUser) IAM 角色。如需详细了解如何授予角色,请参阅管理对项目、文件夹和组织的访问权限

您的管理员还可以通过自定义角色或其他预定义角色向您的用户账号授予所需的权限。

创建笔记本

如需使用 Google Cloud 控制台创建 Colab Enterprise 笔记本,请执行以下操作:

  1. 在 Google Cloud 控制台中,进入 Colab Enterprise 我的笔记本页面。

    前往“我的笔记本”

  2. 区域菜单中,选择要创建笔记本的区域。

  3. 点击  新建笔记本

    Colab Enterprise 会创建并打开您的笔记本。

完成本文档中描述的任务后,您可以通过删除所创建的资源来避免继续计费。如需了解详情,请参阅清理

在默认运行时中运行代码

如需在默认运行时中运行 Colab Enterprise 笔记本的代码,请执行以下操作:

  1. 在 Google Cloud 控制台中,进入 Colab Enterprise 我的笔记本页面。

    前往“我的笔记本”

  2. 区域菜单中,选择包含您的笔记本的区域。

  3. 点击要打开的笔记本。

  4. 将指针悬停在要运行的代码单元上,然后点击  Run cell 按钮。

  5. 如果这是您第一次连接到启用了最终用户凭据的运行时,系统会显示登录对话框。

    如需为 Colab Enterprise 授予对用户凭据的访问权限,请完成以下步骤:

    1. 登录对话框中,点击您的用户账号。

    2. 选择查看、修改、配置和删除您的 Google Cloud 数据...,为 Colab Enterprise 授予对用户凭据的访问权限。

      复选框在“查看、修改、配置和删除您的 Google Cloud 数据,并查看您的 Google 账号的电子邮件地址”句子的旁边。
    3. 点击继续

运行时启动后,Colab Enterprise 会连接到运行时并运行单元中的代码。

重命名笔记本

如需重命名 Colab Enterprise 笔记本,请执行以下操作:

  1. 在 Google Cloud 控制台中,进入 Colab Enterprise 我的笔记本页面。

    前往“我的笔记本”

  2. 区域菜单中,选择包含您的笔记本的区域。

  3. 在要重命名的笔记本旁边,点击 操作菜单,然后选择重命名

  4. 重命名笔记本对话框中,更改笔记本的名称,然后点击重命名

导入笔记本

如需将笔记本导入 Colab Enterprise,请执行以下操作:

  1. 在 Google Cloud 控制台中,进入 Colab Enterprise 我的笔记本页面。

    前往“我的笔记本”

  2. 区域菜单中,选择要导入笔记本的区域。

  3. 点击  导入

  4. 导入笔记本对话框中,选择导入来源

  5. 如果您选择:

    • 计算机,找到并选择要导入的记事本文件。
    • Cloud Storage,在 Cloud Storage 中浏览并选择一个记事本。
    • 网址,输入要导入的记事本文件的网址。
  6. 如需添加其他笔记本,请点击  添加笔记本

  7. 添加要导入的记事本后,点击导入

    Colab Enterprise 会导入您的笔记本文件。

清理

为避免因本教程中使用的资源导致您的 Google Cloud 账号产生费用,请删除包含这些资源的项目,或者保留项目但删除各个资源。

删除项目

  1. In the Google Cloud console, go to the Manage resources page.

    Go to Manage resources

  2. In the project list, select the project that you want to delete, and then click Delete.
  3. In the dialog, type the project ID, and then click Shut down to delete the project.

删除笔记本

如需删除 Colab Enterprise 笔记本,请执行以下操作:
  1. 在 Google Cloud 控制台中,进入 Colab Enterprise 我的笔记本页面。

    前往“我的笔记本”

  2. 区域菜单中,选择包含要删除的笔记本的区域。

  3. 在要删除的笔记本旁边,点击 操作菜单,然后选择  删除笔记本

  4. 删除记事对话框中,点击确认

后续步骤