deploying-on-gcp
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseGCP Patterns
GCP 模式集合
Build applications and infrastructure using Google Cloud Platform services with appropriate service selection, architecture patterns, and best practices.
借助合适的服务选型、架构模式与最佳实践,使用Google Cloud Platform服务构建应用程序与基础设施。
Purpose
用途
This skill provides decision frameworks and implementation patterns for Google Cloud Platform (GCP) services across compute, storage, databases, data analytics, machine learning, networking, and security. It guides service selection based on workload requirements and demonstrates production-ready patterns using Terraform, Python SDKs, and gcloud CLI.
本Skill为GCP在计算、存储、数据库、数据分析、机器学习、网络与安全领域的服务提供决策框架与实现模式。它会根据工作负载需求指导服务选型,并展示使用Terraform、Python SDK及gcloud CLI实现的生产就绪型模式。
When to Use
适用场景
Use this skill when:
- Selecting GCP compute services (Cloud Run, GKE, Cloud Functions, Compute Engine, App Engine)
- Choosing storage or database services (Cloud Storage, Cloud SQL, Spanner, Firestore, Bigtable, BigQuery)
- Designing data analytics pipelines (BigQuery, Pub/Sub, Dataflow, Dataproc, Composer)
- Implementing ML workflows (Vertex AI, AutoML, pre-trained APIs)
- Architecting network infrastructure (VPC, Load Balancing, CDN, Cloud Armor)
- Setting up IAM, security, and cost optimization
- Migrating from AWS or Azure to GCP
- Building multi-cloud or GCP-first architectures
在以下场景中使用本Skill:
- 选择GCP计算服务(Cloud Run、GKE、Cloud Functions、Compute Engine、App Engine)
- 选择存储或数据库服务(Cloud Storage、Cloud SQL、Spanner、Firestore、Bigtable、BigQuery)
- 设计数据分析管道(BigQuery、Pub/Sub、Dataflow、Dataproc、Composer)
- 实现机器学习工作流(Vertex AI、AutoML、预训练API)
- 设计网络基础设施(VPC、负载均衡、CDN、Cloud Armor)
- 配置IAM、安全与成本优化策略
- 从AWS或Azure迁移至GCP
- 构建多云或优先使用GCP的架构
Core Concepts
核心概念
GCP Service Categories
GCP 服务分类
Compute Options:
- Cloud Run: Serverless containers for stateless HTTP services (auto-scale to zero)
- GKE (Google Kubernetes Engine): Managed Kubernetes for complex orchestration
- Cloud Functions: Event-driven functions for simple processing
- Compute Engine: Virtual machines for full OS control
- App Engine: Platform-as-a-Service for web applications
Storage & Databases:
- Cloud Storage: Object storage with Standard/Nearline/Coldline/Archive tiers
- Cloud SQL: Managed PostgreSQL/MySQL/SQL Server (up to 96TB)
- Cloud Spanner: Global distributed SQL with 99.999% SLA
- Firestore: NoSQL document database with real-time sync
- Bigtable: Wide-column NoSQL for time-series and IoT (petabyte scale)
- AlloyDB: PostgreSQL-compatible with 4x performance improvement
Data & Analytics:
- BigQuery: Serverless data warehouse (petabyte-scale SQL analytics)
- Pub/Sub: Global messaging and event streaming
- Dataflow: Apache Beam for stream and batch processing
- Dataproc: Managed Spark and Hadoop clusters
- Cloud Composer: Managed Apache Airflow for workflows
AI/ML Services:
- Vertex AI: Unified ML platform (training, deployment, monitoring)
- AutoML: No-code ML for standard tasks
- Pre-trained APIs: Vision, Natural Language, Speech, Translation
- TPUs: Tensor Processing Units for large model training
计算选项:
- Cloud Run: 用于无状态HTTP服务的无服务器容器(可自动缩容至零实例)
- GKE (Google Kubernetes Engine): 用于复杂编排的托管式Kubernetes服务
- Cloud Functions: 用于简单处理的事件驱动型函数
- Compute Engine: 提供完整操作系统控制权的虚拟机
- App Engine: 面向Web应用的平台即服务(PaaS)
存储与数据库:
- Cloud Storage: 提供Standard/Nearline/Coldline/Archive存储层级的对象存储服务
- Cloud SQL: 托管式PostgreSQL/MySQL/SQL Server服务(最大支持96TB)
- Cloud Spanner: 具备99.999% SLA的全球分布式SQL数据库
- Firestore: 支持实时同步的NoSQL文档数据库
- Bigtable: 适用于时序与IoT数据的宽列NoSQL数据库(PB级规模)
- AlloyDB: 兼容PostgreSQL且性能提升4倍的数据库
数据与分析:
- BigQuery: 无服务器数据仓库(PB级SQL分析能力)
- Pub/Sub: 全球消息与事件流服务
- Dataflow: 基于Apache Beam的流处理与批处理服务
- Dataproc: 托管式Spark与Hadoop集群
- Cloud Composer: 托管式Apache Airflow工作流服务
AI/ML服务:
- Vertex AI: 统一的机器学习平台(训练、部署、监控)
- AutoML: 面向标准任务的无代码机器学习服务
- 预训练API: 视觉、自然语言、语音、翻译API
- TPUs: 用于大模型训练的张量处理单元
Decision Framework: Compute Service Selection
计算服务选型决策框架
Need to run code in GCP?
├─ HTTP service?
│ ├─ YES → Stateless?
│ │ ├─ YES → Cloud Run (auto-scale to zero)
│ │ └─ NO → Need Kubernetes? → GKE | Compute Engine
│ └─ NO (Event-driven)
│ ├─ Simple function? → Cloud Functions
│ └─ Complex orchestration? → GKE | Cloud Run JobsSelection Guide:
- First choice: Cloud Run (unless state or Kubernetes required)
- Need Kubernetes: GKE Autopilot (managed) or Standard (full control)
- Simple events: Cloud Functions (60-min max execution)
- Full control: Compute Engine (VMs with custom configuration)
Need to run code in GCP?
├─ HTTP service?
│ ├─ YES → Stateless?
│ │ ├─ YES → Cloud Run (auto-scale to zero)
│ │ └─ NO → Need Kubernetes? → GKE | Compute Engine
│ └─ NO (Event-driven)
│ ├─ Simple function? → Cloud Functions
│ └─ Complex orchestration? → GKE | Cloud Run Jobs选型指南:
- 首选方案: Cloud Run(除非需要状态管理或Kubernetes)
- 需要Kubernetes: GKE Autopilot(托管式)或Standard(完全控制)
- 简单事件处理: Cloud Functions(最长执行时间60分钟)
- 完全控制权: Compute Engine(可自定义配置的虚拟机)
Decision Framework: Database Selection
数据库选型决策框架
Choose database type:
├─ Relational (SQL)
│ ├─ Multi-region required? → Cloud Spanner
│ ├─ PostgreSQL + high performance? → AlloyDB
│ └─ Standard RDBMS → Cloud SQL (PostgreSQL/MySQL/SQL Server)
│
├─ Document (NoSQL)
│ ├─ Mobile/web with offline sync? → Firestore
│ └─ Flexible schema, no offline? → MongoDB Atlas (Marketplace)
│
├─ Key-Value
│ ├─ Time-series or IoT data? → Bigtable
│ └─ Caching layer? → Memorystore (Redis/Memcached)
│
└─ Analytics
└─ Petabyte-scale SQL analytics → BigQueryChoose database type:
├─ Relational (SQL)
│ ├─ Multi-region required? → Cloud Spanner
│ ├─ PostgreSQL + high performance? → AlloyDB
│ └─ Standard RDBMS → Cloud SQL (PostgreSQL/MySQL/SQL Server)
│
├─ Document (NoSQL)
│ ├─ Mobile/web with offline sync? → Firestore
│ └─ Flexible schema, no offline? → MongoDB Atlas (Marketplace)
│
├─ Key-Value
│ ├─ Time-series or IoT data? → Bigtable
│ └─ Caching layer? → Memorystore (Redis/Memcached)
│
└─ Analytics
└─ Petabyte-scale SQL analytics → BigQueryDecision Framework: Storage Selection
存储选型决策框架
Storage type needed?
├─ Objects/Files
│ ├─ Frequent access → Cloud Storage (Standard)
│ ├─ Monthly access → Cloud Storage (Nearline)
│ ├─ Quarterly access → Cloud Storage (Coldline)
│ └─ Yearly access → Cloud Storage (Archive)
│
├─ Block storage → Persistent Disk (SSD/Standard/Extreme)
└─ Shared filesystem → Filestore (NFS)Storage type needed?
├─ Objects/Files
│ ├─ Frequent access → Cloud Storage (Standard)
│ ├─ Monthly access → Cloud Storage (Nearline)
│ ├─ Quarterly access → Cloud Storage (Coldline)
│ └─ Yearly access → Cloud Storage (Archive)
│
├─ Block storage → Persistent Disk (SSD/Standard/Extreme)
└─ Shared filesystem → Filestore (NFS)GCP vs AWS vs Azure Service Mapping
GCP与AWS、Azure服务映射表
| Category | GCP | AWS | Azure |
|---|---|---|---|
| Serverless Containers | Cloud Run | Fargate | Container Instances |
| Kubernetes | GKE | EKS | AKS |
| Functions | Cloud Functions | Lambda | Functions |
| VMs | Compute Engine | EC2 | Virtual Machines |
| Object Storage | Cloud Storage | S3 | Blob Storage |
| SQL Database | Cloud SQL | RDS | SQL Database |
| NoSQL Document | Firestore | DynamoDB | Cosmos DB |
| Data Warehouse | BigQuery | Redshift | Synapse |
| Messaging | Pub/Sub | SNS/SQS | Service Bus |
| ML Platform | Vertex AI | SageMaker | Machine Learning |
| 分类 | GCP | AWS | Azure |
|---|---|---|---|
| 无服务器容器 | Cloud Run | Fargate | Container Instances |
| Kubernetes | GKE | EKS | AKS |
| 函数计算 | Cloud Functions | Lambda | Functions |
| 虚拟机 | Compute Engine | EC2 | Virtual Machines |
| 对象存储 | Cloud Storage | S3 | Blob Storage |
| SQL数据库 | Cloud SQL | RDS | SQL Database |
| NoSQL文档数据库 | Firestore | DynamoDB | Cosmos DB |
| 数据仓库 | BigQuery | Redshift | Synapse |
| 消息队列 | Pub/Sub | SNS/SQS | Service Bus |
| 机器学习平台 | Vertex AI | SageMaker | Machine Learning |
Architecture Patterns
架构模式
Pattern 1: Serverless Web Application
模式1:无服务器Web应用
Use Case: Stateless HTTP API with database and caching
Architecture:
Internet → Cloud Load Balancer → Cloud Run → Cloud SQL (PostgreSQL)
→ Memorystore (Redis)
→ Cloud StorageKey Services:
- Cloud Run for API service (auto-scaling containers)
- Cloud SQL for transactional data
- Memorystore for caching
- Cloud Storage for file uploads
For detailed Terraform configuration, see .
references/compute-services.md适用场景: 带数据库与缓存的无状态HTTP API
架构:
Internet → Cloud Load Balancer → Cloud Run → Cloud SQL (PostgreSQL)
→ Memorystore (Redis)
→ Cloud Storage核心服务:
- Cloud Run:用于API服务(自动扩缩容容器)
- Cloud SQL:用于事务性数据存储
- Memorystore:用于缓存
- Cloud Storage:用于文件上传存储
如需详细Terraform配置,请查看。
references/compute-services.mdPattern 2: Data Analytics Platform
模式2:数据分析平台
Use Case: Real-time event processing and analytics
Architecture:
Data Sources → Pub/Sub → Dataflow → BigQuery → Looker/Tableau
↓
Cloud Storage (staging)Key Services:
- Pub/Sub for event ingestion (at-least-once delivery)
- Dataflow for stream processing (Apache Beam)
- BigQuery for analytics (partitioned tables, clustering)
- Cloud Storage for staging and backups
For BigQuery optimization patterns, see .
references/data-analytics.md适用场景: 实时事件处理与分析
架构:
Data Sources → Pub/Sub → Dataflow → BigQuery → Looker/Tableau
↓
Cloud Storage (staging)核心服务:
- Pub/Sub:用于事件摄入(至少一次投递保证)
- Dataflow:用于流处理(基于Apache Beam)
- BigQuery:用于分析(分区表、聚类)
- Cloud Storage:用于数据暂存与备份
如需BigQuery优化模式,请查看。
references/data-analytics.mdPattern 3: ML Pipeline
模式3:机器学习管道
Use Case: End-to-end machine learning workflow
Architecture:
Training Data (GCS) → Vertex AI Training → Model Registry → Vertex AI Endpoints
↓
PredictionsKey Services:
- Vertex AI Workbench for notebook development
- Vertex AI Training for custom models (GPU/TPU support)
- Vertex AI Endpoints for model serving (auto-scaling)
- Vertex AI Pipelines for orchestration (Kubeflow)
For ML implementation examples, see .
references/ml-ai-services.md适用场景: 端到端机器学习工作流
架构:
Training Data (GCS) → Vertex AI Training → Model Registry → Vertex AI Endpoints
↓
Predictions核心服务:
- Vertex AI Workbench:用于Notebook开发
- Vertex AI Training:用于自定义模型训练(支持GPU/TPU)
- Vertex AI Endpoints:用于模型部署(自动扩缩容)
- Vertex AI Pipelines:用于工作流编排(基于Kubeflow)
如需机器学习实现示例,请查看。
references/ml-ai-services.mdPattern 4: GKE Microservices Platform
模式4:GKE微服务平台
Use Case: Complex orchestration with multiple services
Architecture:
Internet → Cloud Load Balancer → GKE Cluster
├─ Ingress Controller
├─ Service Mesh (optional)
├─ Microservice A
├─ Microservice B
└─ Microservice CKey Features:
- GKE Autopilot (fully managed nodes) or Standard (custom configuration)
- Workload Identity for secure GCP service access
- Private cluster with Private Google Access
- Config Connector for managing GCP resources via Kubernetes
For GKE setup and best practices, see .
references/compute-services.md适用场景: 包含多个服务的复杂编排场景
架构:
Internet → Cloud Load Balancer → GKE Cluster
├─ Ingress Controller
├─ Service Mesh (optional)
├─ Microservice A
├─ Microservice B
└─ Microservice C核心特性:
- GKE Autopilot(完全托管节点)或Standard(自定义配置)
- Workload Identity:用于安全访问GCP服务
- 带Private Google Access的私有集群
- Config Connector:通过Kubernetes管理GCP资源
如需GKE配置与最佳实践,请查看。
references/compute-services.mdBest Practices
最佳实践
Cost Optimization
成本优化
Compute:
- Use Committed Use Discounts for predictable workloads (57% off)
- Use Spot VMs for fault-tolerant workloads (60-91% off)
- Cloud Run scales to zero when idle (no charges)
- GKE Autopilot charges only for pod resources, not nodes
Storage:
- Use appropriate Cloud Storage classes (Standard/Nearline/Coldline/Archive)
- Enable Object Lifecycle Management to transition cold data
- Archive backups with Coldline or Archive (99% cheaper than Standard)
Data:
- BigQuery: Use partitioned and clustered tables
- Query only needed columns (avoid )
SELECT * - Use BI Engine for caching (up to 10TB free)
- Consider flat-rate pricing for heavy BigQuery usage
For detailed cost strategies, see .
references/cost-optimization.md计算层面:
- 为可预测的工作负载使用Committed Use Discounts(最高优惠57%)
- 为容错型工作负载使用Spot VMs(优惠60-91%)
- Cloud Run在空闲时自动缩容至零实例(无闲置费用)
- GKE Autopilot仅按Pod资源计费,不收取节点费用
存储层面:
- 使用合适的Cloud Storage存储层级(Standard/Nearline/Coldline/Archive)
- 启用对象生命周期管理,自动将冷数据转储至低成本层级
- 使用Coldline或Archive存储备份数据(比Standard便宜99%)
数据层面:
- BigQuery:使用分区表与聚类表
- 仅查询所需列(避免使用)
SELECT * - 使用BI Engine进行缓存(最高支持10TB免费额度)
- 对于高频BigQuery使用场景,考虑采用固定费率定价
如需详细成本优化策略,请查看。
references/cost-optimization.mdSecurity Fundamentals
安全基础
IAM Best Practices:
- Follow principle of least privilege
- Use service accounts, not user accounts for applications
- Enable Workload Identity for GKE workloads (no service account keys)
- Use Secret Manager for secrets, not environment variables
Network Security:
- Use Private Google Access (access GCP services without public IPs)
- Enable Cloud NAT for outbound internet from private instances
- Implement VPC Service Controls for data exfiltration protection
- Use Identity-Aware Proxy (IAP) for zero-trust access
Data Security:
- Enable encryption at rest (default) and in transit
- Use Customer-Managed Encryption Keys (CMEK) for sensitive data
- Implement VPC Service Controls perimeter for data protection
- Enable audit logging for all projects
For comprehensive security patterns, see .
references/security-iam.mdIAM最佳实践:
- 遵循最小权限原则
- 应用程序使用服务账号而非用户账号
- 为GKE工作负载启用Workload Identity(无需服务账号密钥)
- 使用Secret Manager存储密钥,而非环境变量
网络安全:
- 使用Private Google Access(无需公网IP即可访问GCP服务)
- 为私有实例启用Cloud NAT以访问公网
- 配置VPC Service Controls防止数据泄露
- 使用Identity-Aware Proxy(IAP)实现零信任访问
数据安全:
- 启用静态加密(默认开启)与传输加密
- 对敏感数据使用客户管理的加密密钥(CMEK)
- 配置VPC Service Controls安全边界保护数据
- 为所有项目启用审计日志
如需全面的安全模式,请查看。
references/security-iam.mdHigh Availability
高可用性
Multi-Region Strategy:
- Cloud Storage: Use multi-region locations (US, EU, ASIA)
- Cloud SQL: Enable Regional HA (automatic failover)
- Cloud Spanner: Use multi-region configurations (99.999% SLA)
- Global Load Balancing: Route traffic to nearest healthy backend
Backup and Disaster Recovery:
- Cloud SQL: Enable automated backups and point-in-time recovery
- Persistent Disk: Schedule snapshot backups
- Cloud Storage: Enable versioning for critical data
- BigQuery: Use table snapshots for time travel
For networking and HA patterns, see .
references/networking.md多区域策略:
- Cloud Storage:使用多区域存储位置(美国、欧盟、亚洲)
- Cloud SQL:启用区域级高可用(自动故障转移)
- Cloud Spanner:使用多区域配置(99.999% SLA)
- 全球负载均衡:将流量路由至最近的健康后端
备份与灾难恢复:
- Cloud SQL:启用自动备份与时间点恢复
- Persistent Disk:定期创建快照备份
- Cloud Storage:为关键数据启用版本控制
- BigQuery:使用表快照实现时间旅行
如需网络与高可用模式,请查看。
references/networking.mdQuick Reference
快速参考
Common gcloud Commands
常用gcloud命令
bash
undefinedbash
undefinedProject management
Project management
gcloud projects list
gcloud config set project PROJECT_ID
gcloud projects list
gcloud config set project PROJECT_ID
Cloud Run
Cloud Run
gcloud run deploy SERVICE_NAME --image IMAGE_URL --region REGION
gcloud run services list
gcloud run deploy SERVICE_NAME --image IMAGE_URL --region REGION
gcloud run services list
GKE
GKE
gcloud container clusters create-auto CLUSTER_NAME --region REGION
gcloud container clusters get-credentials CLUSTER_NAME --region REGION
gcloud container clusters create-auto CLUSTER_NAME --region REGION
gcloud container clusters get-credentials CLUSTER_NAME --region REGION
Cloud Storage
Cloud Storage
gsutil mb gs://BUCKET_NAME
gsutil cp FILE gs://BUCKET_NAME/
gsutil mb gs://BUCKET_NAME
gsutil cp FILE gs://BUCKET_NAME/
BigQuery
BigQuery
bq mk DATASET_NAME
bq query --use_legacy_sql=false 'SELECT * FROM dataset.table LIMIT 10'
bq mk DATASET_NAME
bq query --use_legacy_sql=false 'SELECT * FROM dataset.table LIMIT 10'
Cloud SQL
Cloud SQL
gcloud sql instances create INSTANCE_NAME --database-version=POSTGRES_15 --region=REGION
gcloud sql connect INSTANCE_NAME --user=postgres
For complete command reference, see `examples/gcloud/common-commands.sh`.gcloud sql instances create INSTANCE_NAME --database-version=POSTGRES_15 --region=REGION
gcloud sql connect INSTANCE_NAME --user=postgres
如需完整命令参考,请查看`examples/gcloud/common-commands.sh`。Python SDK Quick Start
Python SDK 快速入门
python
undefinedpython
undefinedCloud Storage
Cloud Storage
from google.cloud import storage
client = storage.Client()
bucket = client.bucket('my-bucket')
blob = bucket.blob('file.txt')
blob.upload_from_filename('local-file.txt')
from google.cloud import storage
client = storage.Client()
bucket = client.bucket('my-bucket')
blob = bucket.blob('file.txt')
blob.upload_from_filename('local-file.txt')
BigQuery
BigQuery
from google.cloud import bigquery
client = bigquery.Client()
query = "SELECT * FROM LIMIT 10"
results = client.query(query).result()
project.dataset.tablefrom google.cloud import bigquery
client = bigquery.Client()
query = "SELECT * FROM LIMIT 10"
results = client.query(query).result()
project.dataset.tablePub/Sub
Pub/Sub
from google.cloud import pubsub_v1
publisher = pubsub_v1.PublisherClient()
topic_path = publisher.topic_path('project', 'topic-name')
future = publisher.publish(topic_path, b'message data')
For complete Python examples, see `examples/python/`.from google.cloud import pubsub_v1
publisher = pubsub_v1.PublisherClient()
topic_path = publisher.topic_path('project', 'topic-name')
future = publisher.publish(topic_path, b'message data')
如需完整Python示例,请查看`examples/python/`。Terraform Quick Start
Terraform 快速入门
hcl
undefinedhcl
undefinedProvider configuration
Provider configuration
terraform {
required_providers {
google = {
source = "hashicorp/google"
version = "~> 5.0"
}
}
}
provider "google" {
project = "my-project-id"
region = "us-central1"
}
terraform {
required_providers {
google = {
source = "hashicorp/google"
version = "~> 5.0"
}
}
}
provider "google" {
project = "my-project-id"
region = "us-central1"
}
Cloud Run service
Cloud Run service
resource "google_cloud_run_service" "api" {
name = "api-service"
location = "us-central1"
template {
spec {
containers {
image = "gcr.io/project/api:latest"
}
}
}
}
For complete Terraform examples, see `examples/terraform/`.resource "google_cloud_run_service" "api" {
name = "api-service"
location = "us-central1"
template {
spec {
containers {
image = "gcr.io/project/api:latest"
}
}
}
}
如需完整Terraform示例,请查看`examples/terraform/`。Service Selection Cheatsheet
服务选型速查表
| Requirement | Recommended Service | Alternative |
|---|---|---|
| Stateless HTTP API | Cloud Run | App Engine |
| Complex orchestration | GKE Autopilot | GKE Standard |
| Event processing | Cloud Functions | Cloud Run Jobs |
| Object storage | Cloud Storage | N/A |
| Relational database | Cloud SQL | AlloyDB, Spanner |
| NoSQL document | Firestore | MongoDB Atlas |
| Time-series data | Bigtable | N/A |
| Data warehouse | BigQuery | N/A |
| Message queue | Pub/Sub | N/A |
| Stream processing | Dataflow | Dataproc |
| Batch processing | Dataflow | Dataproc |
| ML training | Vertex AI | Custom on GKE |
| Caching | Memorystore Redis | N/A |
| 需求 | 推荐服务 | 替代方案 |
|---|---|---|
| 无状态HTTP API | Cloud Run | App Engine |
| 复杂编排 | GKE Autopilot | GKE Standard |
| 事件处理 | Cloud Functions | Cloud Run Jobs |
| 对象存储 | Cloud Storage | N/A |
| 关系型数据库 | Cloud SQL | AlloyDB, Spanner |
| NoSQL文档数据库 | Firestore | MongoDB Atlas |
| 时序数据 | Bigtable | N/A |
| 数据仓库 | BigQuery | N/A |
| 消息队列 | Pub/Sub | N/A |
| 流处理 | Dataflow | Dataproc |
| 批处理 | Dataflow | Dataproc |
| 机器学习训练 | Vertex AI | 基于GKE的自定义训练 |
| 缓存 | Memorystore Redis | N/A |
Integration with Other Skills
与其他Skill的集成
Related Skills:
- infrastructure-as-code: Use Terraform to provision GCP resources (see )
examples/terraform/ - kubernetes-operations: Deploy and manage applications on GKE
- building-ci-pipelines: Use Cloud Build for CI/CD to Cloud Run or GKE
- secret-management: Use Secret Manager for sensitive configuration
- observability: Use Cloud Monitoring and Cloud Logging for metrics and logs
- data-architecture: Design data lakes and warehouses using BigQuery and Cloud Storage
- mlops-patterns: Implement ML pipelines using Vertex AI
- aws-patterns: Compare AWS and GCP service equivalents for multi-cloud
- azure-patterns: Compare Azure and GCP service equivalents
相关Skill:
- infrastructure-as-code: 使用Terraform部署GCP资源(查看)
examples/terraform/ - kubernetes-operations: 在GKE上部署与管理应用
- building-ci-pipelines: 使用Cloud Build为Cloud Run或GKE构建CI/CD流水线
- secret-management: 使用Secret Manager管理敏感配置
- observability: 使用Cloud Monitoring与Cloud Logging收集指标与日志
- data-architecture: 使用BigQuery与Cloud Storage设计数据湖与数据仓库
- mlops-patterns: 使用Vertex AI实现机器学习管道
- aws-patterns: 对比AWS与GCP服务,用于多云场景
- azure-patterns: 对比Azure与GCP服务
Progressive Disclosure
进阶文档
For detailed documentation:
- Compute services: See for Cloud Run, GKE, Cloud Functions, Compute Engine, and App Engine patterns
references/compute-services.md - Storage & databases: See for detailed service selection and configuration
references/storage-databases.md - Data analytics: See for BigQuery, Pub/Sub, Dataflow, and Dataproc patterns
references/data-analytics.md - ML/AI services: See for Vertex AI, AutoML, and pre-trained API usage
references/ml-ai-services.md - Networking: See for VPC, Load Balancing, CDN, and Cloud Armor patterns
references/networking.md - Security & IAM: See for IAM patterns, Workload Identity, and Secret Manager
references/security-iam.md - Cost optimization: See for detailed cost reduction strategies
references/cost-optimization.md
For working examples:
- Terraform configurations: See for infrastructure templates
examples/terraform/ - Python SDK usage: See for client library examples
examples/python/ - gcloud CLI commands: See for command reference
examples/gcloud/common-commands.sh
如需详细文档:
- 计算服务: 查看获取Cloud Run、GKE、Cloud Functions、Compute Engine及App Engine的相关模式
references/compute-services.md - 存储与数据库: 查看获取详细的服务选型与配置指南
references/storage-databases.md - 数据分析: 查看获取BigQuery、Pub/Sub、Dataflow及Dataproc的相关模式
references/data-analytics.md - ML/AI服务: 查看获取Vertex AI、AutoML及预训练API的使用方法
references/ml-ai-services.md - 网络: 查看获取VPC、负载均衡、CDN及Cloud Armor的相关模式
references/networking.md - 安全与IAM: 查看获取IAM模式、Workload Identity及Secret Manager的相关内容
references/security-iam.md - 成本优化: 查看获取详细的成本削减策略
references/cost-optimization.md
如需实战示例:
- Terraform配置: 查看获取基础设施模板
examples/terraform/ - Python SDK用法: 查看获取客户端库示例
examples/python/ - gcloud CLI命令: 查看获取命令参考
examples/gcloud/common-commands.sh
Key Decisions Summary
核心决策总结
When choosing GCP:
- Data analytics workloads (BigQuery is best-in-class)
- ML/AI applications (Vertex AI, TPUs, Google Research backing)
- Kubernetes-native applications (GKE invented by Kubernetes creators)
- Serverless containers (Cloud Run is mature and cost-effective)
- Real-time streaming (Pub/Sub + Dataflow)
GCP's unique advantages:
- BigQuery: Serverless, petabyte-scale, fastest data warehouse
- Cloud Run: Most mature serverless container platform
- GKE: Most advanced managed Kubernetes (Autopilot mode)
- Vertex AI: Unified ML platform (training, deployment, monitoring)
- Per-second billing and sustained use discounts (automatic cost savings)
Multi-region recommendations:
- Production workloads: Use multi-region for 99.95%+ SLA
- Cloud Storage: Multi-region for global access
- Cloud Spanner: Multi-region for global transactions
- Global Load Balancing: Route to nearest healthy backend
选择GCP的场景:
- 数据分析工作负载(BigQuery是同类最佳)
- ML/AI应用(Vertex AI、TPU、Google Research技术支持)
- Kubernetes原生应用(GKE由Kubernetes发明者打造)
- 无服务器容器(Cloud Run成熟且性价比高)
- 实时流处理(Pub/Sub + Dataflow)
GCP的独特优势:
- BigQuery:无服务器、PB级规模、速度最快的数据仓库
- Cloud Run:最成熟的无服务器容器平台
- GKE:最先进的托管式Kubernetes服务(Autopilot模式)
- Vertex AI:统一的机器学习平台(训练、部署、监控)
- 按秒计费与持续使用折扣(自动节省成本)
多区域部署建议:
- 生产工作负载:使用多区域部署以获得99.95%以上的SLA
- Cloud Storage:使用多区域存储以支持全球访问
- Cloud Spanner:使用多区域配置以支持全球事务
- 全球负载均衡:将流量路由至最近的健康后端