Cloud SQL Overview

Cloud SQL is a fully managed relational database service that makes it easy to set up, maintain, manage, and administer your relational databases on Google Cloud Platform. It supports MySQL, PostgreSQL, and SQL Server. As an Associate Cloud Engineer, you must understand that Cloud SQL shifts the “operational burden” of database management (patching, backups, scaling) from you to Google.

The Analogy: The Managed Apartment Complex

Think of Cloud SQL like living in a high-end managed apartment complex. You own the furniture and the items inside (your data and schema), but the building management handles the plumbing, electrical maintenance, security, and cleaning of the hallways (patching, backups, and hardware). If you need more space, they can move you to a bigger unit (vertical scaling) or provide a guest suite for visitors (read replicas).

Core Concepts & Best Practices

1. Reliability and Availability

For the ACE exam, remember the difference between High Availability (HA) and Read Replicas. HA uses a regional setup with a primary instance in one zone and a standby instance in another zone within the same region. Data is synchronously replicated to the standby. If the primary fails, Cloud SQL automatically fails over to the standby.

2. Scalability

  • Vertical Scaling: Increasing CPU or RAM. This requires a brief downtime as the instance restarts.
  • Horizontal Scaling: Using Read Replicas to offload read traffic from the primary instance.

3. Security

Cloud SQL data is encrypted at rest and in transit. Access is controlled via Cloud IAM for administrative tasks and VPC Firewall rules or Cloud SQL Auth Proxy for database connections. Using the Auth Proxy is the Google-recommended best practice for secure connections without managing IP whitelists.

Service Variant Comparison

Feature MySQL PostgreSQL SQL Server
Best Use Case Web apps, LAMP stacks Complex queries, LBS data Enterprise .NET apps
Max Storage 100 TB 100 TB 100 TB
High Availability Regional (Zonal Standby) Regional (Zonal Standby) Regional (Zonal Standby)
Point-in-Time Recovery Yes (Binary Logs) Yes (Write-ahead logs) Yes (Transaction logs)

Decision Matrix: If/Then

If the requirement is… Then use…
A relational database that scales globally with horizontal writes. Cloud Spanner (Cloud SQL is regional).
A managed MySQL/PostgreSQL/SQL Server instance in one region. Cloud SQL.
Automated failover across zones. Cloud SQL High Availability configuration.
Reducing latency for users in a different continent (reads only). Cross-region Read Replicas.

Exam Tips: Golden Nuggets

  • The “Proxy” Choice: On the exam, if you see a question about connecting to Cloud SQL securely from GKE or App Engine, the “Cloud SQL Auth Proxy” is almost always the correct answer.
  • Backup vs. PITR: Backups are for disaster recovery; Point-in-Time Recovery (PITR) requires Binary Logging to be enabled (for MySQL).
  • Storage Auto-increase: You can enable storage to grow automatically, but you cannot decrease the storage size once it has been allocated.
  • Cloud SQL vs. BigQuery: Cloud SQL is OLTP (Online Transactional Processing). BigQuery is OLAP (Online Analytical Processing). Don’t use Cloud SQL for massive data warehousing.

Cloud SQL Architecture & Flow

App Engine / GKE SQL Auth Proxy Primary Instance (Zone A) Sync Replication Standby (HA) Read Replica

Key GCP Services

Cloud SQL integrates seamlessly with Cloud IAM for permissions, Cloud Monitoring for performance metrics, and Cloud Logging for audit trails.

Common Pitfalls

Don’t forget to enable Binary Logging for MySQL if you need PITR. Also, remember that HA failover changes the IP address unless you use the Auth Proxy.

Architecture Patterns

Pattern: Use Read Replicas for reporting dashboards to ensure the Primary instance stays performant for user transactions.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top