← 返回
开发者工具 中文

Google Cloud

Deploy, monitor, and manage GCP services with battle-tested patterns.
利用久经考验的模式部署、监控和管理 GCP 服务。
ivangdavila
开发者工具 clawhub v1.0.0 1 版本 99558.5 Key: 无需
★ 4
Stars
📥 3,077
下载
💾 73
安装
1
版本
#latest

概述

Google Cloud Production Rules

Cost Traps

  • Stopped Compute Engine VMs still pay for persistent disks and static IPs — delete disks or use snapshots for long-term storage
  • Cloud NAT charges per VM and per GB processed — use Private Google Access for GCP API traffic instead
  • BigQuery on-demand pricing charges for bytes scanned, not rows returned — partition tables and use LIMIT in dev, but LIMIT doesn't reduce scan cost in prod
  • Preemptible VMs save 80% but can be terminated anytime — only for fault-tolerant batch workloads
  • Egress to internet costs, egress to same region is free — keep resources in same region, use Cloud CDN for global distribution

Security Rules

  • Service accounts are both identity and resource — one service account can impersonate another with roles/iam.serviceAccountTokenCreator
  • IAM policy inheritance: Organization → Folder → Project → Resource — deny policies at org level override allows below
  • VPC Service Controls protect against data exfiltration — but break Cloud Console access if not configured with access levels
  • Default Compute Engine service account has Editor role — create dedicated service accounts with least privilege
  • Workload Identity Federation eliminates service account keys — use for GitHub Actions, GitLab CI, external workloads

Networking

  • VPC is global, subnets are regional — unlike AWS, single VPC can span all regions
  • Firewall rules are allow-only by default — implicit deny all ingress, allow all egress. Add explicit deny rules for egress control
  • Private Google Access is per-subnet setting — enable on every subnet that needs to reach GCP APIs without public IP
  • Cloud Load Balancer global vs regional — global for multi-region, but regional is simpler and cheaper for single region
  • Shared VPC separates network admin from project admin — host project owns network, service projects consume it

Performance

  • Cloud Functions gen1 has 9-minute timeout — gen2 (Cloud Run based) allows 60 minutes
  • Cloud SQL connection limits vary by instance size — use connection pooling or Cloud SQL Auth Proxy
  • Firestore/Datastore hotspotting on sequential IDs — use UUIDs or reverse timestamps for document IDs
  • GKE Autopilot simplifies but limits — no DaemonSets, no privileged containers, no host network
  • Cloud Storage single object limit is 5TB — use compose for larger, parallel uploads for faster

Monitoring

  • Cloud Logging retention: 30 days default, \_Required bucket is 400 days — create custom bucket with longer retention for compliance
  • Cloud Monitoring alert policies have 24-hour auto-close — incident disappears even if issue persists, configure notification channels for re-alert
  • Error Reporting groups by stack trace — same error with different messages creates duplicates
  • Cloud Trace sampling is automatic — may miss rare errors, increase sampling rate for debugging
  • Audit logs: Admin Activity always on, Data Access off by default — enable Data Access logs for security compliance

Infrastructure as Code

  • Terraform google provider requires project ID everywhere — use google_project data source or variables, never hardcode
  • gcloud commands are imperative — use Deployment Manager or Terraform for reproducible infra
  • Cloud Build triggers on push but IAM permissions on first run confusing — grant Cloud Build service account necessary roles before first deploy
  • Project deletion has 30-day recovery period — but project ID is globally unique forever, can't reuse
  • Labels propagate to billing — use consistent labeling for cost allocation: env, team, service

IAM Best Practices

  • Primitive roles (Owner/Editor/Viewer) are too broad — use predefined roles, create custom for least privilege
  • Service account keys are security liability — use Workload Identity, impersonation, or attached service accounts instead
  • roles/iam.serviceAccountUser lets you run as that SA — equivalent to having its permissions, grant carefully
  • Organization policies restrict what projects can do — constraints/compute.vmExternalIpAccess blocks public VMs org-wide

版本历史

共 1 个版本

  • v1.0.0 当前
    2026-03-28 14:42 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

developer-tools

Gog

steipete
Google Workspace 命令行工具,支持 Gmail、日历、云端硬盘、通讯录、表格和文档。
★ 921 📥 185,739
ai-intelligence

Self-Improving + Proactive Agent

ivangdavila
自我反思+自我批评+自我学习+自组织记忆。智能体评估自身工作、发现错误并持续改进。
★ 1,350 📥 317,745
developer-tools

Github

steipete
使用 `gh` CLI 与 GitHub 交互,通过 `gh issue`、`gh pr`、`gh run` 和 `gh api` 管理议题、PR、CI 运行及高级查询。
★ 668 📥 323,844