๋ณธ๋ฌธ์œผ๋กœ ๊ฑด๋„ˆ๋›ฐ๊ธฐ
ๅฐ้พ™่™พๅฐ้พ™่™พAI
๐Ÿค–

Google Cloud

Deploy, monitor, and manage GCP services with battle-tested patterns.

ไธ‹่ฝฝ3.3k
ๆ˜Ÿๆ ‡4
็‰ˆๆœฌ1.0.0
DevOps่ฟ็ปด
ๅฎ‰ๅ…จ้€š่ฟ‡
๐Ÿ’ฌPrompt

ๆŠ€่ƒฝ่ฏดๆ˜Ž


name: Google Cloud description: Deploy, monitor, and manage GCP services with battle-tested patterns. metadata: {"clawdbot":{"emoji":"๐ŸŒ","requires":{"anyBins":["gcloud"]},"os":["linux","darwin","win32"]}}

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

ๅฆ‚ไฝ•ไฝฟ็”จใ€ŒGoogle Cloudใ€๏ผŸ

  1. ๆ‰“ๅผ€ๅฐ้พ™่™พAI๏ผˆWeb ๆˆ– iOS App๏ผ‰
  2. ็‚นๅ‡ปไธŠๆ–นใ€Œ็ซ‹ๅณไฝฟ็”จใ€ๆŒ‰้’ฎ๏ผŒๆˆ–ๅœจๅฏน่ฏๆก†ไธญ่พ“ๅ…ฅไปปๅŠกๆ่ฟฐ
  3. ๅฐ้พ™่™พAI ไผš่‡ชๅŠจๅŒน้…ๅนถ่ฐƒ็”จใ€ŒGoogle Cloudใ€ๆŠ€่ƒฝๅฎŒๆˆไปปๅŠก
  4. ็ป“ๆžœๅณๆ—ถๅ‘ˆ็Žฐ๏ผŒๆ”ฏๆŒ็ปง็ปญๅฏน่ฏไผ˜ๅŒ–

็›ธๅ…ณๆŠ€่ƒฝ