在 Google Cloud 控制台中使用 Gemini Cloud Assist

本文档介绍如何在 Google Cloud 控制台中的 Cloud Assist 面板中获取 AI 辅助功能。

借助 Cloud Assist 面板,您可以编写自然语言语句或问题(称为“提示”),以获取深入的说明、建议的操作或引导式工作流,从而帮助您快速高效地完成任务,而无需成为云专家。在预览版期间,使用此面板无需支付任何费用。

了解 Gemini for Google Cloud 如何以及何时使用您的数据

准备工作

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

    Go to project selector

  2. 确保已为您的 Google Cloud 项目设置了 Gemini Cloud Assist。

打开和关闭 Cloud Assist 面板

  1. 在 Google Cloud 控制台中,前往任意页面,例如信息中心页面。

    转到信息中心

  2. 在 Google Cloud 控制台工具栏中,点击 星光图标 打开或关闭 Gemini Cloud Assist 对话

    系统将打开 Cloud Assist 面板。您可以点击显示的示例提示,也可以在输入提示字段中输入提示

您可以通过以下几种方式管理 Cloud Assist 面板:

  • 如需将 Cloud Assist 面板展开至浏览器窗口的完整宽度,请点击 open_in_new 以完整页面打开

    Cloud Assist 面板会在新标签页中打开。您的原始会话会在原始标签页中保持打开状态。如要关闭展开的视图,请关闭相应标签页。

  • 如要关闭 Cloud Assist 面板,请点击 星光图标 打开或关闭 Gemini Cloud Assist 对话。如果您未选择启用对话记录,对话记录仍会保持有效,直到您更改项目或退出 Google Cloud 控制台。如需重新打开 Cloud Assist 面板,请点击 星光图标 打开或关闭 Gemini Cloud Assist 对话

在 Cloud Assist 面板中输入提示的快速示例

  1. 在 Google Cloud 控制台中,前往任意页面,例如信息中心页面。

    转到信息中心

  2. 在 Google Cloud 控制台工具栏中,点击 星光图标 打开或关闭 Gemini Cloud Assist 对话

  3. Cloud Assist 面板的输入提示字段中,输入以下提示,然后点击发送 发送提示

    Create a gcloud command to give the developer Google group
    access to view my Google Cloud project.
    

    Cloud Assist 面板中,会显示一条回答。

  4. 输入提示字段中,发送后续提示:

    Change that to editor access.
    

    Gemini Cloud Assist 在回答提示时会使用您的对话记录来获取更多上下文信息。例如,Gemini 会在回答中提供更新后的说明和命令。

  5. 可选:如果您看到显示相关内容链接,请点击该链接以获取更多信息。只有在有更多信息时,系统才会显示此链接。

对话面板用例

以下部分详细介绍了其他 Cloud Assist 面板用例。

了解产品知识和最佳实践

Gemini Cloud Assist 可以访问最新的 Google Cloud产品信息和使用最佳实践。它可以帮助您比较不同的Google Cloud 产品并选择合适的产品。它还可以提供建议,以便您以有效、高效且合规的方式配置和使用 Google Cloud 产品。请尝试以下一些提示:

  • What is Secret Manager?
  • What is the difference between Cloud Run and Cloud Functions?
  • When should I use a managed instance group?
  • What are some best practices for using KMS?
  • What storage class should I use for my data?
  • Help me choose a regulatory control for my Google Cloud folders.

限制:由于影响费用和价格的因素众多,Gemini Cloud Assist 通常不会在对话中提供服务价格数据。如需了解价格信息,请直接访问相应服务的价格页面。

检查您的云资源、应用和数据

Gemini Cloud Assist 可以访问云环境中的信息。本部分介绍了如何向 Gemini Cloud Assist 询问资源配置和指标,以及它如何帮助您在 BigQuery 或 Google Cloud 数据库中查询数据。

了解资源、政策和近期变更

如需了解资源、政策和近期变更,请尝试以下一些提示:

  • What are the names of my instances and their private interface names?
  • List the name and network name for the subnetworks.
  • How many BigQuery datasets have a label whose value is "inventory"?
  • List all config changes in the last 24 hours.
  • When was my key last rotated?
  • List all users granted roles/bigquery.admin and include the attached resources.

除了提供所请求的信息外,Gemini Cloud Assist 还会为您提供等效查询,您可以自行运行该查询来验证结果。

限制:由于 Cloud Asset Inventory 需要组织,因此使用 Gemini Cloud Assist 访问 Cloud Asset Inventory 以了解已部署的资产及其近期更改也需要组织。此外,当您首次提交使用 Gemini Cloud Assist 的提示时,Gemini Cloud Assist 可能需要几分钟时间来设置查询环境。如果查询失败,请等待几分钟,然后重试。

分析资源性能

如需快速分析资源(例如流量、吞吐量和执行)的性能趋势,请尝试以下一些提示:

  • Which of my VMs have the highest utilization?
  • What are the top 5 dataflow jobs with the highest estimated backlog processing time?
  • Total VM network bytes sent per second for each instance?
  • What's the QPS on my SQL databases?

限制:由于影响费用和定价的因素众多,Gemini Cloud Assist 通常不提供费用数据。如需了解费用或账单信息,请访问 FinOps 中心

如果您订阅了存储空间分析情报,并且拥有访问存储空间分析数据集Storage Insights Viewer 角色,那么您可以在相应的 Google Cloud 控制台存储空间页面上发送有关特定存储桶和对象的提示。例如,您可以发送以下提示:

  • How many bytes are stored in my buckets in the us-central1 location?
  • What is my Cloud Storage usage, broken down by content type?
  • How many objects do I have in Standard storage smaller than 50 GB?

关于 BigQuery 数据集的帮助

如需获取有关 BigQuery 数据集配置的帮助,请尝试使用以下提示:How many BigQuery datasets have a label whose value is 'inventory'?

此外,在 Google Cloud 控制台中的 BigQuery 页面上,您可以在 Cloud Assist 面板中需求有关编写 SQL 查询的帮助。例如,如果您有一个包含拼车服务数据的数据集,则可以输入以下提示:Generate a SQL query to show me the direction and subscriber type for the 10 longest trips.

在此示例中,Gemini Cloud Assist 提供了一个特定的 SQL 查询,您可以查看该查询并将其复制到 BigQuery 查询编辑器中。您还可以寻求有关使用 Python 查询数据的帮助,例如,您可以提示 Gemini Cloud Assist Generate Python code to query the bigquery-public-data.ml_datasets.penguins table using BigQuery magics.

关于数据库的帮助

如需获取数据库部署方面的帮助,请尝试以下提示:

  • Where are my databases located?
  • Show me all databases running on Postgres.
  • How many databases do I have in the US?

在特定 Cloud SQL 数据库实例的 Google Cloud 控制台页面上,您还可以请求获取数据库性能信息,并寻求排查潜在问题方面的帮助。例如 What is the current CPU utilization of this database?

设计和部署 Google Cloud 应用

本部分详细介绍了一些示例,以帮助您设计和部署 Google Cloud应用。

寻求创建资源的帮助

您可以向 Gemini Cloud Assist 寻求有关使用 Google Cloud CLI 命令或 Terraform 创建资源或政策的帮助,Gemini Cloud Assist 会回复一段代码,您可以将其复制到 shell 或 IaC 代码库中。例如:

  • How do I use Google Cloud CLI to execute a Cloud Run job and set the timeout to 20 minutes?
  • I want to grant the user "user@company.com" the "Security Administrator" role for the "prod-subnet" subnet for project "xyz-123". What Google Cloud CLI command can I use?
  • Give me a Terraform configuration to create an Enterprise Plus Postgresql database instance with data caching.

创建新应用

您可以让 Gemini Cloud Assist 帮助您创建应用。例如:Help me create a three tier web application for a new CMS system

除了提供一些入门建议和建议的架构外,Gemini Cloud Assist 还会提供一个链接,以便您在 App Design Center 开始构建应用。这样,您就可以将此提示和回答的上下文直接转移到 Google Cloud 视觉应用设计体验中。

此外,Gemini Cloud Assist 付费层级用户可以Cloud Assist 面板中对 App Design Center 使用自然语言来迭代更新其应用架构。

调查问题并排查问题

您可以使用 Cloud Assist 面板,在 Gemini Cloud Assist 的帮助下完成应用问题的初步调查和排查。

查看影响您项目的 Google Cloud 突发事件

如需查看影响您项目的 Google Cloud 突发事件,请尝试以下一些提示:

  • Is there something going on with Google Cloud? I'm seeing issues with my project.
  • What's the latest update on the Compute Engine outage in us-central1?
  • How is my project impacted by the Cloud Storage incident?
  • Is there a workaround for the BigQuery incident?

调查数据库问题

如需了解潜在的数据库(包括性能、健康状况和合规性),请尝试以下一些提示:

  • What is the current CPU utilization of this database?
  • Which of my queries have high latency for this database instance?
  • What is the slowest query for this database in this instance?
  • How many error log entries are there for this database instance?
  • What issues are affecting my databases?
  • What databases have NIST issues in Europe?

优化 Google Cloud 资源

如需帮助优化您的 Google Cloud 资源并针对预计节省的费用和集群可靠性获取具体建议,请尝试以下提示:

  • Give me recommendations to reduce my resource costs.
  • What are all the quotas for my project that are almost hitting the limit?
  • What BigQuery datasets should I partition or cluster?
  • Which of my VMs are idle?

清除对话会话

如需清除对话会话记录,请在 Cloud Assist 面板中点击 清除对话记录

在控制台之外获得对话式协助

如需在集成开发环境 (IDE) 中(而非 Google Cloud 控制台中)使用 Cloud Assist 窗格,请在 IDE 中设置 Gemini Code Assist

如需在 IDE 中与 Cloud Storage 对话,请点击 星光图标 打开或关闭 Gemini Cloud Assist 对话

限制

如果您为文件夹设置 Gemini Cloud Assist,并在 Google Cloud 控制台中使用文件夹级的 Cloud Assist 面板,那么对于支持应用的产品,辅助和回答仅限于与该文件夹相关的应用。以下列表包含在文件夹级别支持的 Google Cloud 产品:

如需获取有关其他产品和资源的帮助,请使用 Google Cloud 控制台页面顶部的项目选择器来选择项目资源。

此外,您必须在文件夹上启用应用管理,才能在文件夹级别使用 Cloud Assist 面板。

后续步骤