Skip to content

You are viewing a free preview of this lesson.

Subscribe to unlock all 10 lessons in this course and every other course on LearningBro.

Cloud SQL Overview

Cloud SQL Overview

Cloud SQL is Google Cloud's fully managed relational database service. It supports three popular database engines — MySQL, PostgreSQL, and SQL Server — and handles the heavy lifting of provisioning, patching, backups, replication, and failover so you can focus on building your application instead of administering databases.


What Is Cloud SQL?

Cloud SQL provides managed relational database instances running on Google's infrastructure. You choose an engine (MySQL, PostgreSQL, or SQL Server), configure the instance size, and Google takes care of the rest:

  • Automated backups with point-in-time recovery.
  • Automatic storage increases so your database never runs out of space.
  • High availability with automatic failover to a standby instance.
  • Security — encryption at rest and in transit by default, IAM integration, and VPC-native connectivity.
  • Maintenance windows — Google applies patches during your chosen window.

Supported Engines

Engine Versions Typical Use Cases
MySQL 5.6, 5.7, 8.0 Web applications, CMS (WordPress, Drupal), e-commerce
PostgreSQL 12, 13, 14, 15, 16 Geospatial (PostGIS), analytics, complex queries
SQL Server 2017, 2019, 2022 .NET applications, enterprise workloads, legacy migrations

Each engine supports standard SQL and the extensions/features you expect from a self-managed installation.


Instance Types and Machine Tiers

Cloud SQL offers several machine types to match your workload:

Tier Description vCPUs RAM
Shared-core Budget-friendly, burstable 0.6 - 1 0.6 - 3.8 GB
Lightweight Small production workloads 1 - 2 3.75 - 13 GB
Standard General-purpose production 4 - 96 15 - 624 GB
High-memory Memory-intensive workloads 4 - 96 26 - 624 GB

You can change machine types with a brief restart, allowing you to scale vertically as your workload grows.


Storage

Cloud SQL uses persistent SSD or HDD storage:

  • SSD — recommended for production; low latency, high IOPS.
  • HDD — lower cost; suitable for non-performance-critical workloads.
  • Automatic storage increase — when enabled, storage grows automatically when usage reaches a threshold. No downtime required.
  • Maximum storage — up to 64 TB per instance.

High Availability

Cloud SQL supports regional high availability (HA) with a synchronous standby replica in a different zone:

  1. Writes are committed to both the primary and standby before acknowledged.
  2. If the primary fails, automatic failover promotes the standby within seconds.
  3. The HA instance uses a shared IP address — your application reconnects automatically.

HA approximately doubles the cost of the instance but provides an SLA of 99.95% for HA instances.


Backups and Recovery

  • Automated backups — daily backups retained for up to 365 days.
  • On-demand backups — create a backup at any time.
  • Point-in-time recovery (PITR) — restore to any point within the backup retention period using binary logs (MySQL) or WAL (PostgreSQL).
  • Export — export data to Cloud Storage in SQL or CSV format for archival or migration.

Connectivity

Cloud SQL supports several connectivity options:

  • Private IP — connect from your VPC using a private service access connection. Recommended for production.
  • Public IP — connect over the internet. Must be secured with SSL and authorised networks.
  • Cloud SQL Auth Proxy — a sidecar proxy that handles authentication and encryption. Simplifies connectivity from GKE, Compute Engine, Cloud Run, and local development.
  • Serverless VPC Access — connect from Cloud Functions and Cloud Run to Cloud SQL over a private IP.

Security

  • Encryption at rest — all data encrypted with AES-256 by default. CMEK (Customer-Managed Encryption Keys) available.
  • Encryption in transit — SSL/TLS enforced for public IP connections. Automatic for private IP within the VPC.
  • IAM database authentication — authenticate to PostgreSQL or MySQL using IAM instead of database passwords.
  • VPC Service Controls — restrict data exfiltration by placing Cloud SQL inside a service perimeter.

Pricing

Cloud SQL pricing is based on:

  • Instance type (vCPUs and memory) — per-second billing.
  • Storage — per GB per month (SSD or HDD).
  • Network egress — data transferred out of the instance.
  • HA — approximately double the instance cost.
  • Backups — per GB stored beyond the initial included backup.

Summary

Cloud SQL is the go-to managed relational database for GCP workloads. It supports MySQL, PostgreSQL, and SQL Server with automated backups, high availability, and seamless VPC connectivity. Choose it when you need a familiar relational engine with the operational burden handled by Google.