Skip to content

aktonay/skillz / skills/cloud/cloud-sql-basics

cloud-sql-basics

Verified

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.

FileKindSize
SKILL.mdskill md3.5 KB
references/cli-usage.mdmarkdown1.5 KB
references/client-library-usage.mdmarkdown2.9 KB
references/core-concepts.mdmarkdown2.0 KB
references/iac-usage.mdmarkdown1.2 KB
references/iam-security.mdmarkdown2.9 KB
references/mcp-usage.mdmarkdown2.4 KB

references/iam-security.md

View on GitHub
# Cloud SQL IAM & Security

Cloud SQL uses Identity and Access Management (IAM) to control access to
instances and databases.

## Predefined IAM Roles

| Predefined Role | Usage |
| :--- | :--- |
| `roles/cloudsql.admin` | Full control over all Cloud SQL resources. |
| `roles/cloudsql.editor` | Manage Cloud SQL resources. Cannot see or modify

 permissions, nor modify users or ssl Certs. Cannot import data or restore from
a backup, nor clone, delete, or promote instances. Cannot start or stop
  replicas. Cannot delete databases, replicas, or backups. |
| `roles/cloudsql.viewer` | Read-only access to Cloud SQL resources. |
| `roles/cloudsql.client` | Connectivity access to Cloud SQL instances from App
 Engine and the Cloud SQL Auth Proxy. Not required for accessing an instance
  using IP addresses. |
| `roles/cloudsql.instanceUser` | Permission to log in to a Cloud SQL
  instance. |
| `roles/cloudsql.schemaViewer` | Role allowing access to a Cloud SQL instance
  schema in Knowledge Catalog. |
| `roles/cloudsql.studioUser` | Role allowing access to Cloud SQL Studio. |

## Secure Connectivity

-   **Cloud SQL Auth Proxy:** The recommended way to connect securely. It
    provides IAM-based authentication and end-to-end encryption without
    requiring SSL/TLS certificates or authorized networks.

-   **Private IP:** Use VPC, private services access, or Private Service Connect
    (PSC) to keep database traffic within the Google Cloud network.

-   **Authorized Networks:** If using Public IP, restrict access to specific
    CIDR ranges.

## Data Security

-   **Encryption at Rest:** All data is encrypted by default. Use
    Customer-Managed Encryption Keys (CMEK) for additional control.

-   **IAM Database Authentication:** Authenticate to the database using IAM
    users or service accounts instead of static passwords (available for MySQL
    and PostgreSQL).

## Organization Policies

-   **Cloud SQL organization policies:** Organization policies let organization
    administrators set restrictions on how users can configure instances under
    that organization.

## Service Accounts

-   **Service Identity:** Cloud SQL uses an instance service account
    (`p[PROJECT_NUMBER]-[UNIQUE_ID]@gcp-sa-cloud-sql.iam.gserviceaccount.com`)
    for tasks like exporting a SQL dump file to Cloud Storage. Service agent
    accounts (`service-PROJECT_NUMBER@gcp-sa-cloud-sql.iam.gserviceaccount.com`)
    are used only for internal management tasks.

-   **App Connectivity:** Grant the service account running your app (e.g., on
    Cloud Run or GKE) the `roles/cloudsql.client` role.

For more information, see: 
- [About Access Control - Cloud SQL for MySQL](https://docs.cloud.google.com/sql/docs/mysql/instance-access-control)
- [About Access Control - Cloud SQL for PostgreSQL](https://docs.cloud.google.com/sql/docs/postgres/instance-access-control)
- [About Access Control - Cloud SQL for SQL Server](https://docs.cloud.google.com/sql/docs/sqlserver/instance-access-control)
deprecation-and-migrationaddyosmani/agent-skillsManages deprecation and migration. Use when removing old systems, APIs, or features. Use when migrating users from one implementation to another. Use when migrating a database schema in production, such as renaming or dropping a column without downtime (expand/contract). Use when deciding whether to maintain or sunset existing code.Stars: 119kUpdated Claude CodeCodexVerifiedInstall
performance-optimizationaddyosmani/agent-skillsOptimizes application performance across frontend, backend, queries, and databases. Use when performance requirements exist, when you suspect performance regressions, when Core Web Vitals or load times need improvement, when N+1 query patterns need fixing, or when profiling reveals bottlenecks.Stars: 119kUpdated Claude CodeCodexVerifiedInstall
Agent Cost Reportthedotmack/claude-memBelievable agent cost report for any period, default the last 7 full days PT, not counting today. Measured tokens from Claude Code transcripts priced at OpenRouter list prices (ESTIMATED), measured provider spend when a sanctioned source exists, note-taker cost separate, Timing-style HTML/PDF plus report.json, line-items.csv, evidence.json.Stars: 118kUpdated Claude CodeCodexVerifiedInstall
Agent Cost Reportthedotmack/claude-memBelievable agent cost report for any period, default the last 7 full days PT, not counting today. Measured tokens from Claude Code transcripts priced at OpenRouter list prices (ESTIMATED), measured provider spend when a sanctioned source exists, note-taker cost separate, Timing-style HTML/PDF plus report.json, line-items.csv, evidence.json.Stars: 118kUpdated Claude CodeCodexVerifiedInstall