tech/google/cloud/database

DATABASE

GCP database skill (stub). Use when: (1) running managed Postgres/MySQL/SQL Server on Cloud SQL,

production Cloud SQL (Postgres 13–16, MySQL 8.0), AlloyDB, Spanner, Firestore Native, Bigtable
requires: tech/google/cloud

GCP Databases (stub)

Status: stub. Production depth pending.

Decision tree

NeedPick
Standard relational, <few TBCloud SQL (Postgres most common)
Postgres compatible, high-perf OLTP (~4x Cloud SQL)AlloyDB
Global consistency, >10TB or multi-region writesSpanner
Serverless doc store, mobile SDKFirestore (Native)
Wide-column, time-series, IoT at petabyte scaleBigtable
In-memory cacheMemorystore (Redis/Memcached/Valkey)

Quick starts

# Cloud SQL for Postgres
gcloud sql instances create my-pg \
  --database-version POSTGRES_16 \
  --region africa-south1 \
  --tier db-custom-2-7680 \
  --storage-type SSD --storage-size 20 --storage-auto-increase \
  --availability-type ZONAL \
  --backup --enable-point-in-time-recovery

# Firestore (Native mode)
gcloud firestore databases create --location=africa-south1 \
  --type=firestore-native

# Memorystore Redis
gcloud redis instances create my-cache \
  --size 1 --region africa-south1 --tier basic

Connecting from Cloud Run to Cloud SQL

# Option 1: Cloud SQL Auth Proxy built in (recommended)
gcloud run services update my-service --region africa-south1 \
  --set-cloudsql-instances=my-app-prod:africa-south1:my-pg \
  --set-env-vars INSTANCE_UNIX_SOCKET=/cloudsql/my-app-prod:africa-south1:my-pg
# Connect via unix socket — no IP, no network config

Gotchas (high-level)

See Also