0
0
GCPcloud~10 mins

Creating a Cloud SQL instance in GCP - Visual Walkthrough

Choose your learning style9 modes available
Process Flow - Creating a Cloud SQL instance
Start: Define instance config
Call API to create instance
Cloud SQL service processes request
Instance provisioning begins
Instance status: PENDING
Instance status: CREATING
Instance status: RUNNABLE
Instance ready for connections
This flow shows how defining a Cloud SQL instance configuration leads to API call, provisioning, and finally a ready-to-use database instance.
Execution Sample
GCP
gcloud sql instances create my-instance \
  --database-version=POSTGRES_15 \
  --tier=db-f1-micro \
  --region=us-central1
This command creates a small PostgreSQL Cloud SQL instance in the us-central1 region.
Process Table
StepActionAPI RequestInstance StatusResult
1Define instance parametersN/AN/AParameters set: name=my-instance, version=POSTGRES_15, tier=db-f1-micro, region=us-central1
2Send create instance commandCreateInstance API calledPENDINGRequest accepted, provisioning starts
3Cloud SQL service provisions resourcesN/ACREATINGCompute and storage allocated
4Initialize database engineN/ACREATINGDatabase software installed and configured
5Instance becomes runnableN/ARUNNABLEInstance ready to accept connections
6Connect to instanceN/ARUNNABLEConnection successful, instance operational
💡 Instance status RUNNABLE means creation finished and instance is ready
Status Tracker
VariableStartAfter Step 2After Step 3After Step 5Final
instance_statusN/APENDINGCREATINGRUNNABLERUNNABLE
api_requestNoneCreateInstance API calledN/AN/AN/A
connection_readyFalseFalseFalseTrueTrue
Key Moments - 2 Insights
Why does the instance status change from PENDING to CREATING before it becomes RUNNABLE?
The execution_table shows that after the API call (PENDING), Cloud SQL allocates resources and installs software (CREATING) before the instance is ready (RUNNABLE). This is normal provisioning progress.
Can you connect to the instance immediately after sending the create command?
No. According to the execution_table, connection_ready is False until the instance status is RUNNABLE (Step 5). Trying earlier will fail.
Visual Quiz - 3 Questions
Test your understanding
Look at the execution_table, what is the instance_status at Step 3?
ACREATING
BPENDING
CRUNNABLE
DTERMINATED
💡 Hint
Check the 'Instance Status' column at Step 3 in the execution_table
At which step does connection_ready become True according to variable_tracker?
AAfter Step 2
BAfter Step 3
CAfter Step 5
DAfter Step 1
💡 Hint
Look at the 'connection_ready' row in variable_tracker and see when it changes to True
If the API request failed at Step 2, what would be the instance_status in the execution_table?
ARUNNABLE
BNo status or error
CCREATING
DPENDING
💡 Hint
Consider what happens if the CreateInstance API call does not succeed at Step 2
Concept Snapshot
Creating a Cloud SQL instance:
- Use 'gcloud sql instances create [NAME]'
- Specify database version, tier, and region
- Instance status moves: PENDING -> CREATING -> RUNNABLE
- Only connect when status is RUNNABLE
- Provisioning includes resource allocation and software setup
Full Transcript
Creating a Cloud SQL instance starts by defining the instance parameters like name, database version, machine tier, and region. Then, a create instance API call is made. The Cloud SQL service processes this request and begins provisioning resources. The instance status changes from PENDING to CREATING as compute and storage are allocated and the database engine is installed. When provisioning finishes, the status becomes RUNNABLE, meaning the instance is ready to accept connections. Only after this point can you connect to the database instance successfully.