Catalog
google/cloud-sql-basics

google

cloud-sql-basics

This file generates or explains Cloud SQL resources. Use this file when the user asks to create a Cloud SQL instance or database for MySQL, PostgreSQL, or SQL Server. Cloud SQL manages third-party MySQL, PostgreSQL, and SQL Server instances as resources in Cloud SQL. For example, when Cloud SQL creates an open-source MySQL instance, the resulting resource is a Cloud SQL for MySQL instance that Google Cloud manages. Cloud SQL handles backups, high availability, and secure connectivity for relational database workloads.

global
category:Databases
New~882
v1.1Saved Jun 28, 2026

Cloud SQL Basics

Cloud SQL is a fully managed relational database service for MySQL, PostgreSQL, and SQL Server. It automates time-consuming tasks like patches, updates, backups, and replicas, while providing high performance and availability for your applications.

Prerequisites

Ensure you have the necessary IAM permissions to create and manage Cloud SQL instances. The Cloud SQL Admin (roles/cloudsql.admin) role provides full access to Cloud SQL resources.

Quick Start (PostgreSQL)

  1. Enable the API:

    gcloud services enable sqladmin.googleapis.com --quiet
    
  2. Create an Instance:

    gcloud sql instances create INSTANCE_NAME \
      --database-version=POSTGRES_18 \
      --cpu=2 \
      --memory=7680MiB \
      --region=REGION \
      --quiet
    
  3. Set a password for the default user:

    Because this is a Cloud SQL for PostgreSQL instance, the default admin user is postgres:

    gcloud sql users set-password postgres \
      --instance=INSTANCE_NAME --password=PASSWORD \
      --quiet
    
  4. Create a database:

    gcloud sql databases create DATABASE_NAME \
      --instance=INSTANCE_NAME \
      --quiet
    
  5. Get the instance connection name:

    You need the instance connection name (which is formatted as PROJECT_ID:REGION:INSTANCE_NAME) to connect using the Cloud SQL Auth Proxy. Retrieve it with the following command:

    gcloud sql instances describe INSTANCE_NAME \
      --format="value(connectionName)" \
      --quiet
    
  6. Connect to the instance:

    The Cloud SQL Auth Proxy must be running to be able to connect to the instance. In a separate terminal, start the proxy using the connection name:

    ./cloud-sql-proxy INSTANCE_CONNECTION_NAME
    

    With the proxy running, connect using psql in another terminal:

    psql "host=127.0.0.1 port=5432 user=postgres dbname=DATABASE_NAME password=PASSWORD sslmode=disable"
    

Reference Directory

  • Core Concepts: Instance architecture, high availability (HA), and supported database engines.

  • CLI Usage: Essential gcloud sql commands for instance, database, and user management.

  • Client Libraries & Connectors: Connecting to Cloud SQL using Python, Java, Node.js, and Go.

  • MCP Usage: Using the Cloud SQL remote MCP server and Gemini CLI extension.

  • Infrastructure as Code: Terraform configuration for instances, databases, and users.

  • IAM & Security: Predefined roles, SSL/TLS certificates, and Auth Proxy configuration.

If you need product information not found in these references, use the Developer Knowledge MCP server search_documents tool.

Files7
7 files · 24.1 KB

Select a file to preview

Grade adjusted by static analysis guardrails

AI scored this skill as grade B, but static analysis findings capped it to C:

  • Hardcoded credentials or secrets detected in content (max: C)

Overall Score

78/100

Grade

C

Adequate

Safety

78

Quality

80

Clarity

82

Completeness

72

Summary

This skill provides foundational guidance on creating and managing Cloud SQL instances (MySQL, PostgreSQL, SQL Server) using gcloud CLI, Terraform, client libraries, and MCP tooling. It includes quick-start commands, reference documentation for core concepts, security practices, and example configurations.

Static Analysis Findings

1 finding

Patterns detected by deterministic static analysis before AI scoring. Hover over any finding code for detailed information and remediation guidance.

Credential Exposure
SEC-023Plaintext Password or Secret2x in 2 filesMax: C

Password or secret in plaintext

references/iac-usage.mdpassword = "changeme
references/client-library-usage.mdpassword="my-password

Detected Capabilities

gcloud CLI executionTerraform configuration guidanceAPI documentation referenceClient library setup instructionsMCP tool integration

Trigger Keywords

Phrases that MCP clients use to match this skill to user intent.

create cloud sql instanceset up postgresql databasecloud sql terraformconnect to cloud sqlcloud sql security setupmanage database users

Risk Signals

WARNING

Plaintext password in Terraform example

references/iac-usage.md:34
WARNING

Plaintext password in Python connector example

references/client-library-usage.md:59
INFO

Plaintext password in gcloud CLI example

references/cli-usage.md:49

Referenced Domains

External domains referenced in skill content, detected by static analysis.

cloud.google.comdocs.cloud.google.comgithub.commcp-toolbox.devregistry.terraform.iowww.apache.org

Use Cases

  • Set up a Cloud SQL instance for production workloads
  • Create a managed PostgreSQL database with high availability
  • Connect to Cloud SQL using language-specific connectors (Python, Java, Node.js, Go)
  • Provision Cloud SQL infrastructure using Terraform
  • Configure IAM roles and secure connectivity for Cloud SQL
  • Use MCP tools to automate Cloud SQL operations and migrations

Quality Notes

  • Comprehensive reference documentation with clear subsections for each database engine
  • Includes examples across multiple languages and infrastructure tools
  • Quick-start section provides practical, step-by-step setup for PostgreSQL
  • References to official Google Cloud documentation for deeper learning
  • Plaintext passwords in examples are labeled as placeholders ('changeme', 'my-password') and not actual credentials—this is standard for documentation, but examples should emphasize the use of environment variables or secrets management
  • IAM section provides clear guidance on role-based access control
  • Security best practices are well-documented (Auth Proxy, Private IP, encryption at rest)
  • Missing explicit error handling guidance for common failure modes (e.g., permission denied, instance creation timeouts)
  • No guidance on cost optimization or resource sizing decisions
Model: claude-haiku-4-5-20251001Analyzed: Jun 28, 2026

Reviews

Add this skill to your library to leave a review.

No reviews yet

Be the first to share your experience.

Version History

  1. v1.1

    Content updated

    ✦ AIAdds --quiet flag to gcloud commands and adds blank lines before code blocks for readability.

    2026-06-28

    Latest
  2. v1.0

    2026-05-02

    Initial version

Use google/cloud-sql-basics in your dev environment

Command Palette

Search for a command to run...