Skip to content
Cloud SQL Basics

Cloud SQL BasicsSkill

Released
5 views
Apache-2.0
Repository Docs

Summary

Google's official Cloud SQL skill — create and connect MySQL, PostgreSQL and SQL Server instances with the right gcloud commands, Auth Proxy setup, HA and backup model.

Features

  • Working quick start: instance, admin password, database, connection name, Auth Proxy, psql
  • Edition comparison — Enterprise vs Enterprise Plus, read pools and high availability
  • Connector and client-library guidance for Python, Java, Node.js and Go
  • Terraform resources for instances, databases and users
  • Disaster recovery: backup types, PITR, replicas and Advanced DR

Install This Skill

Add this skill to your favorite AI agent in a few steps.

Any AI agent

This skill is plain instructions — it works with any assistant that accepts custom instructions or system prompts.

  1. Copy the skill content with the button below.
  2. Paste it into your agent's instruction file or system prompt (for example AGENTS.md, .cursorrules, or a custom instructions field).
  3. Ask the agent to apply the skill whenever the task matches.

Skill Content

Markdown Content

Copy this content and use it with your preferred AI agent

---
name: cloud-sql-basics
metadata:
  category: Databases
description: >-
  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.
---

# 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:**
    
    ```bash
    gcloud services enable sqladmin.googleapis.com --quiet
    ```

2.  **Create an Instance:**
    
    ```bash
    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`:
    
    ```bash
    gcloud sql users set-password postgres \
      --instance=INSTANCE_NAME --password=PASSWORD \
      --quiet
    ```

4.  **Create a database:**
    
    ```bash
    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:
    
    ```bash
    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:
    
    ```bash
    ./cloud-sql-proxy INSTANCE_CONNECTION_NAME
    ```

    With the proxy running, connect using `psql` in another terminal:
    
    ```bash
    psql "host=127.0.0.1 port=5432 user=postgres dbname=DATABASE_NAME password=PASSWORD sslmode=disable"
    ```

## Reference Directory

-   [Core Concepts](references/core-concepts.md): Cloud SQL editions (Enterprise
    & Enterprise Plus), instance architecture, read pools, high availability (HA),
    and supported database engines.

-   [CLI Usage](references/cli-usage.md): Essential `gcloud sql` commands for
    instance, database, and user management.

-   [Client Libraries & Connectors](references/client-library-usage.md):
    Connecting to Cloud SQL using Python, Java, Node.js, and Go.

-   [MCP Usage](references/mcp-usage.md): Using the Cloud SQL remote MCP
    server and Gemini CLI extension.

-   [Infrastructure as Code](references/iac-usage.md): Terraform
    configuration for instances, databases, and users.

-   [IAM & Security](references/iam-security.md): Predefined roles, SSL/TLS
    certificates, and Auth Proxy configuration.

-   [Disaster Recovery & Backups](references/dr-backups.md): Backup types,
    Point-in-Time Recovery (PITR), replicas, read pools comparison, and Enterprise Plus Advanced DR.

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

Usage Instructions

Learn how to use this skill with different AI agents.

Generic Instructions

Install from Google's official skills repository:

npx skills add google/skills --skill cloud-sql-basics

Or install the whole repository and pick interactively:

npx skills add google/skills

Example Usage

"Provision a highly available Cloud SQL for PostgreSQL instance in europe-west1, create an app database and user, and show me how to connect from a local machine through the Auth Proxy."

Description

Cloud SQL is Google Cloud's managed relational database for MySQL, PostgreSQL and SQL Server. The gap agents fall into is not the SQL — it is everything around it: which gcloud sql flags actually exist, why a psql connection hangs without the Auth Proxy running, and which edition you need before high availability or read pools are even an option.

This skill from Google's official skills repository walks the whole first path end to end: enabling the Admin API, creating an instance with a concrete machine shape, setting the default admin user's password, creating a database, retrieving the PROJECT:REGION:INSTANCE connection name, starting cloud-sql-proxy, and connecting through it. Each step is a command the agent can run rather than a description of a console screen.

Behind that sits a reference directory the agent pulls in on demand: Enterprise versus Enterprise Plus editions, instance architecture, read pools and high availability; the full gcloud sql command surface for instances, databases and users; connectors and client libraries for Python, Java, Node.js and Go; the Cloud SQL remote MCP server and Gemini CLI extension; Terraform for instances, databases and users; predefined IAM roles, SSL/TLS certificates and Auth Proxy configuration; and the disaster-recovery model — backup types, point-in-time recovery, replicas and Enterprise Plus Advanced DR.

Reach for it when an agent is provisioning a Cloud SQL instance, debugging a connection that will not open, or reviewing whether an existing setup can actually survive a zone failure.

Related Skills

New

Google's official skill for the gws CLI — drive Gmail, Drive, Calendar, Sheets, Docs, Chat and Admin APIs from an agent, with Model Armor screening.

4 views 1 copies
New

Netlify's official skill for zero-config managed Postgres — querying from Functions, Drizzle setup, migrations and per-preview database branches.

3 views

Official WordPress skill for Gutenberg block work: block.json, attributes and serialization, dynamic rendering, and the deprecation path that keeps existing content valid.

2 views

Skill: claude-mem

by thedotmack

New

Persistent cross-session memory for coding agents: hooks capture each session, a local SQLite + vector store compresses it, and a mem-search skill reads it back.

1 views
Browse all skills →