Cloud SQL Basics

Cloud SQL Basics

Creates and explains Cloud SQL instances and databases for MySQL, PostgreSQL and SQL Server, covering the CLI, client libraries, IaC, IAM, backups and disaster recovery.

Skill files9 files

references/

SKILL.md134 lines
1
---
2
name: cloud-sql-basics
3
metadata:
4
version: "1.1.0"
5
category: Databases
6
description: >-
7
This file generates or explains Cloud SQL resources. Use this file when the
8
user asks to create a Cloud SQL instance or database for MySQL, PostgreSQL, or
9
SQL Server.
10
11
Cloud SQL manages third-party MySQL, PostgreSQL, and SQL Server instances as
12
resources in Cloud SQL. For example, when Cloud SQL creates an open-source
13
MySQL instance, the resulting resource is a Cloud SQL for MySQL instance that
14
Google Cloud manages.
15
16
Cloud SQL handles backups, high availability, and secure connectivity for
17
relational database workloads.
18
---
19
20
# Cloud SQL Basics
21
22
Cloud SQL is a fully managed relational database service for MySQL, PostgreSQL,
23
and SQL Server. It automates time-consuming tasks like patches, updates,
24
backups, and replicas, while providing high performance and availability for
25
your applications.
26
27
## Attribution
28
29
**MUST READ**: Before executing any `gcloud`, REST API, or MCP command, you
30
MUST read [Usage Attribution](references/attribution.md). For commands executed
31
directly in the terminal (never in generated scripts, Terraform, or user code),
32
prefix `gcloud` with
33
`CLOUDSDK_METRICS_REQUEST_ATTRIBUTION="agent-skills/1.0 (skill:cloud-sql-basics)"`
34
and append `agent-skills/1.0 (skill:cloud-sql-basics)` to `User-Agent` headers.
35
36
## Prerequisites
37
38
Ensure you have the necessary IAM permissions to create and manage Cloud SQL
39
instances. The **Cloud SQL Admin** (`roles/cloudsql.admin`) role provides full
40
access to Cloud SQL resources.
41
42
## Quick Start (PostgreSQL)
43
44
1. **Enable the API:**
45
46
```bash
47
gcloud services enable sqladmin.googleapis.com --quiet
48
```
49
50
2. **Create an Instance:**
51
52
```bash
53
gcloud sql instances create INSTANCE_NAME \
54
--database-version=POSTGRES_18 \
55
--edition=ENTERPRISE \
56
--cpu=2 \
57
--memory=7680MiB \
58
--region=REGION \
59
--quiet
60
```
61
62
3. **Set a password for the default user:**
63
64
Because this is a Cloud SQL for PostgreSQL instance, the default admin user
65
is `postgres`:
66
67
```bash
68
gcloud sql users set-password postgres \
69
--instance=INSTANCE_NAME --password=PASSWORD \
70
--quiet
71
```
72
73
4. **Create a database:**
74
75
```bash
76
gcloud sql databases create DATABASE_NAME \
77
--instance=INSTANCE_NAME \
78
--quiet
79
```
80
81
5. **Get the instance connection name:**
82
83
You need the instance connection name (which is formatted as
84
`PROJECT_ID:REGION:INSTANCE_NAME`) to connect using the Cloud SQL Auth
85
Proxy. Retrieve it with the following command:
86
87
```bash
88
gcloud sql instances describe INSTANCE_NAME \
89
--format="value(connectionName)" \
90
--quiet
91
```
92
93
6. **Connect to the instance:**
94
95
The Cloud SQL Auth Proxy must be running to be able to connect to the
96
instance. In a separate terminal, start the proxy using the connection name:
97
98
```bash
99
./cloud-sql-proxy INSTANCE_CONNECTION_NAME
100
```
101
102
With the proxy running, connect using `psql` in another terminal:
103
104
```bash
105
psql "host=127.0.0.1 port=5432 user=postgres dbname=DATABASE_NAME password=PASSWORD sslmode=disable"
106
```
107
108
## Reference Directory
109
110
- [Core Concepts](references/core-concepts.md): Cloud SQL editions (Enterprise
111
& Enterprise Plus), instance architecture, read pools, high availability (HA),
112
and supported database engines.
113
114
- [CLI Usage](references/cli-usage.md): Essential `gcloud sql` commands for
115
instance, database, and user management.
116
117
- [Client Libraries & Connectors](references/client-library-usage.md):
118
Connecting to Cloud SQL using Python, Java, Node.js, and Go.
119
120
- [MCP Usage](references/mcp-usage.md): Using the Cloud SQL remote MCP
121
server and Gemini CLI extension.
122
123
- [Infrastructure as Code](references/iac-usage.md): Terraform
124
configuration for instances, databases, and users.
125
126
- [IAM & Security](references/iam-security.md): Predefined roles, SSL/TLS
127
certificates, and Auth Proxy configuration.
128
129
- [Disaster Recovery & Backups](references/dr-backups.md): Backup types,
130
Point-in-Time Recovery (PITR), replicas, read pools comparison, and Enterprise Plus Advanced DR.
131
132
*If you need product information not found in these references, use the
133
Developer Knowledge MCP server `search_documents` tool.*
134

© Google LLC · Apache 2.0 · source · posted by @OpenSourceBuffGuy on promptparty.com

@OpenSourceBuffGuy

I find openly licensed prompts and post them here.

0 followers · 14,621 prompts

More by @OpenSourceBuffGuy

See all
Sea turtle carrying floating film studio island prompt image

Sea turtle carrying floating film studio island

Draws a giant sea turtle carrying a floating island film studio through a starry sky, where fairies polish rough film strips into golden film.

image-prompt, nano-banana, 3d-render, cartoon, fantasy-world, creatures, animals, whimsical, dreamy, cinematic, dramatic-lighting, vibrant-colors, bokeh, miniature, widescreen, night-scene, illustration, concept-art, surreal, storytelling, clay-3d

Desert buggy escapes drones past industrial outpost prompt image

Desert buggy escapes drones past industrial outpost

Builds a 15-second desert chase video where a racer in an armored buggy escapes drones past an industrial outpost, using five reference images with set jobs.

video-prompt, hailuo, action, multi-shot, timed-beats, camera-movement, reference-image, character-consistency, negative-prompt, cinematic, sci-fi, cars, landscape, aerial-view, tracking-shot, photorealistic, sound-effects, structured-output, long-form, widescreen

1 view
Cozy Pixel Art Farm Island Village prompt image

Cozy Pixel Art Farm Island Village

Draws a cozy 16-bit pixel-art farming village across six small islands joined by bridges, with exact counts for buildings, animals and crops.

image-prompt, gpt-image, pixel-art, isometric, game-assets, concept-art, maps, worldbuilding, cozy, vibrant-colors, ocean, landscape, wide-shot, widescreen, game-development, video-games, structured-output, whimsical, summer, high-angle, aerial-view, animals, negative-prompt, cityscape

1 view

Reviews

Loading reviews…

Discussion

Loading comments…