A Cloud SQL instance is a managed database service in Google Cloud that lets you run relational databases like MySQL, PostgreSQL, or SQL Server without managing the underlying hardware or software.
Click to reveal answer
beginner
Which command-line tool can you use to create a Cloud SQL instance?
You can use the gcloud command-line tool to create and manage Cloud SQL instances.
Click to reveal answer
beginner
What are the key parameters needed to create a Cloud SQL instance?
You need to specify the instance name, database version (like MySQL 8.0), region, and machine tier (CPU and memory size).
Click to reveal answer
intermediate
Why is it important to choose the right region when creating a Cloud SQL instance?
Choosing a region close to your users reduces latency and can improve performance. It also affects data residency and compliance.
Click to reveal answer
beginner
What is the benefit of using a managed service like Cloud SQL instead of running your own database server?
Cloud SQL handles backups, patching, replication, and scaling automatically, so you can focus on your application instead of managing database infrastructure.
Click to reveal answer
Which database engines can you run on Cloud SQL?
AOracle, DB2, Sybase
BMongoDB, Cassandra, Redis
CSQLite, MariaDB, Firebase
DMySQL, PostgreSQL, SQL Server
✗ Incorrect
Cloud SQL supports MySQL, PostgreSQL, and SQL Server as managed relational databases.
What is the correct gcloud command to create a MySQL 8.0 Cloud SQL instance named 'my-instance' in region 'us-central1'?
But you get an error saying the tier is invalid. What is the likely cause?
medium
A. The tier name is correct but the database version is invalid
B. The region us-west1 does not support MySQL 5.7
C. The tier name should be db-n1-standard-1 with 'db-' prefix
D. The tier name requires a different format for MySQL
Solution
Step 1: Check tier naming conventions
Cloud SQL machine tiers use the 'db-' prefix. The correct tier name is 'db-n1-standard-1'.
Step 2: Validate other parameters
MySQL 5.7 is valid, and us-west1 supports it. The error is due to missing 'db-' prefix in tier name.
Final Answer:
The tier name should be db-n1-standard-1 with 'db-' prefix -> Option C
Quick Check:
Tier names include 'db-' prefix [OK]
Hint: Add 'db-' prefix to tier names for Cloud SQL [OK]
Common Mistakes:
Omitting 'db-' prefix in tier names
Assuming region limits cause tier errors
Mixing database version errors with tier errors
5. You want to create a highly available Cloud SQL instance with PostgreSQL 13 in region us-central1. Which command correctly sets up a primary instance with high availability enabled?
hard
A. gcloud sql instances create ha-instance --database-version=POSTGRES_13 --region=us-central1 --availability-type=REGIONAL
B. gcloud sql instances create ha-instance --database-version=POSTGRES_13 --region=us-central1 --high-availability
C. gcloud sql instances create ha-instance --database-version=POSTGRES_13 --region=us-central1 --availability=HIGH
D. gcloud sql instances create ha-instance --database-version=POSTGRES_13 --region=us-central1 --replica-type=PRIMARY
Solution
Step 1: Identify flag for high availability
The correct flag to enable high availability in Cloud SQL is --availability-type=REGIONAL.
Step 2: Confirm other parameters
Database version POSTGRES_13 and region us-central1 are valid. The command uses correct syntax for creating a highly available instance.