Cloud SQL — Managed relational databases
PostgreSQL, MySQL, or SQL Server run by Google: backups, high availability, upgrades, and patches handled for you.
Cloud SQL is a fully-managed RDBMS offering Postgres, MySQL, and SQL Server. Google owns the VM, OS, engine patching, backups (daily + WAL archiving for PITR), and optional HA failover to a standby in another zone.
Connectivity: (a) public IP + authorized networks + SSL — convenient but exposed; (b) private IP via peering — recommended; (c) Cloud SQL Auth Proxy / language connectors — recommended for serverless (Cloud Run, Cloud Functions). The proxy uses IAM to authenticate and wraps TCP in TLS.
High Availability: regional configuration synchronously replicates to a standby in a second zone. RTO ~60s on failover, RPO ≈ 0 (synchronous). Read replicas (async) scale read throughput but add replica lag.
Backups: automated daily snapshots retained 7–365 days, plus continuous WAL for point-in-time recovery within the retention window. Test your restore procedure — a backup you never restored is not a backup.
Cloud Run + Cloud SQL: use the runtime Cloud SQL connector (language libs) with the instance's service account having roles/cloudsql.client. Set max_connections carefully — Cloud Run can spawn many instances, each opening a pool, which can exhaust the DB connection limit (use a connection pooler like PgBouncer or app-level pooling).
Pricing: machine type + storage + network + HA multiplier + backups. Smallest tier (db-f1-micro on shared CPU) runs ~$10/mo; production tiers quickly reach $100–500/mo. AlloyDB is Google's higher-perf Postgres-compatible alternative for demanding workloads.
Grounded on https://cloud.google.com/sql/docs/introduction
Next up
Secret Manager — Store secrets safely
A vault for API keys, DB passwords, and JWT secrets. Versioned, IAM-controlled, mounted as env vars in Cloud Run or fetched at build time by Cloud Build.