1. 简介
欢迎参加 2025 年 Cloud Run Day!所有讲座都将围绕“新闻”这一主题展开。
2. 设置 Google Cloud 环境
创建项目
- 在 Google Cloud 控制台的项目选择器页面上,选择或创建一个 Google Cloud 项目。建议:将其命名为“cloud-run-workshop”
- 确保您的云项目已启用结算功能。了解如何 检查项目是否已启用结算功能。
- 点击此 链接 以激活 Cloud Shell。
- 如需设置活跃账号,请在 Cloud Shell 中运行以下命令:
gcloud config set account <ACCOUNT>
- 如需检查您的身份验证,请在 Cloud Shell 中运行以下命令:
gcloud auth list
- 使用以下命令确认项目 ID:
gcloud config list project
- 设置项目 ID 变量。将 <YOUR_PROJECT_ID> 替换为上一步中的 ID:
export PROJECT_ID=<YOUR_PROJECT_ID> && gcloud config set project $PROJECT_ID
export REGION=europe-west1 && gcloud config set run/region $REGION
- 设置 Google API 密钥:
使用 https://aistudio.google.com/app/apikey 生成 API 密钥,然后将该密钥粘贴到此处:
export GOOGLE_API_KEY=PASTE_YOUR_ACTUAL_API_KEY_HERE
export GOOGLE_GENAI_USE_VERTEXAI=FALSE
- 启用必需的 API:
gcloud services enable cloudresourcemanager.googleapis.com \
servicenetworking.googleapis.com \
run.googleapis.com \
cloudbuild.googleapis.com \
artifactregistry.googleapis.com \
aiplatform.googleapis.com \
compute.googleapis.com \
storage.googleapis.com
(这可能需要几分钟时间。)
克隆 Cloud Run Day 讲座的代码示例
如需访问所有讲座的示例代码,请克隆整个代码库:
git clone https://github.com/abhishekr700/Cloud-Run-Day-Workshop-2025.git