It is the default home for a relational application database on Google Cloud.
Cloud SQL runs PostgreSQL, MySQL or SQL Server for you: provisioning, patching, backups, replication and failover. You still own schema, queries and sizing.
Key choices at creation:
- Edition: Enterprise, or Enterprise Plus with faster machines, a data cache, near-zero-downtime maintenance and higher availability SLA.
- Machine shape: vCPUs and memory, plus SSD storage that can grow automatically.
- Availability type:
ZONAL, orREGIONALfor high availability, a standby in another zone with synchronous disk replication and automatic failover. - Connectivity: private IP (via private services access or PSC) and/or public IP.
Backups: automated daily backups plus point-in-time recovery from transaction logs. Read replicas (in-region or cross-region) offload reads and serve as disaster-recovery targets. An HA standby is not readable.
Connecting securely: avoid opening public IPs to 0.0.0.0/0. Use private IP, or the Cloud SQL Auth Proxy or language connectors, which authenticate with IAM and encrypt traffic without managing certificates. Cloud Run has built-in support (--add-cloudsql-instances) that exposes a Unix socket at /cloudsql/PROJECT:REGION:INSTANCE. IAM database authentication lets users and service accounts log in without passwords.
When a single instance is no longer enough, look at AlloyDB or Spanner.
Example
gcloud sql instances create shop-pg --database-version=POSTGRES_17 \
--edition=ENTERPRISE --cpu=2 --memory=8GiB --region=europe-west1 \
--availability-type=REGIONAL --enable-point-in-time-recovery
gcloud sql databases create shop --instance=shop-pg
gcloud sql users create app --instance=shop-pg --password="$(openssl rand -base64 24)"
# Local development through the Auth Proxy (uses your ADC credentials)
cloud-sql-proxy shop-dev-4821:europe-west1:shop-pg --port 5432 &
psql "host=127.0.0.1 port=5432 dbname=shop user=app"
# Cloud Run: socket at /cloudsql/shop-dev-4821:europe-west1:shop-pg
gcloud run deploy orders-api --image=IMAGE --region=europe-west1 \
--add-cloudsql-instances=shop-dev-4821:europe-west1:shop-pgRemember
- REGIONAL availability = standby in another zone with automatic failover
- Enable PITR; add read replicas for reads and DR
- Connect via private IP or the Auth Proxy/connectors, not open public IPs
Watch out for
- Expecting the HA standby to serve read traffic; use a read replica for that.