Cloud SQL quick start

This guide explains how to connect Google Cloud SQL databases to Cast AI DBO. You connect your Google Cloud project through cloud connect, DBO discovers your Cloud SQL instances (including instances with private IPs), and you deploy the DBO components with the script or Helm command the console provides.

To configure Cloud SQL Proxy separately in the DBO pod, see Configure Cloud SQL Proxy for DBO.

Prerequisites

  • A Google Cloud project with the Cloud SQL instances you want to optimize.
  • A Google Kubernetes Engine (GKE) cluster where the DBO components will run, with network access to your Cloud SQL instances.
  • For the Kubernetes path: kubectl configured to access your cluster and the helm CLI installed.

Connect your Google Cloud project

Open Database onboarding

Sign in to the Cast AI console and select Database in the left navigation.

Start cloud connection

On the Overview page, click + Connect instance.

Choose GCP cloud connect

In the resulting dialog, select Connect your cloud and select GCP as your cloud service provider.

Run the discovery script

Run the provided discovery script in your cloud shell or terminal. The script creates the Google Cloud service account DBO uses, grants it the permissions it needs, and scans your projects to discover database instances; you do not create or attach anything manually.

The Connecting to cloud dialog tracks discovery, which continues in the background if you close it.

Enable optimization and deploy the components

Enable database optimization

When discovery completes, your Cloud SQL instances appear on the Overview page, ranked by optimization opportunity. Click Enable database optimizer on the instance you want to start with.

Deploy DBO

In the resulting dialog, choose the optimization features you want to enable for that instance.
Copy the deployment script or Helm command the console provides and run it. DBO deploys into the castai-db-optimizer namespace in your GKE cluster.

Start Performance Advisor analysis

Once DBO is deployed, Performance Advisor starts analyzing your workloads. It requires no proxy routing, and first recommendations typically appear within about 30 minutes.

Verify the deployment

In your cluster, check that the DBO pods are running:

kubectl get pods -n castai-db-optimizer

In the console, your Cloud SQL instance appears in the Select database server picker alongside your other instances, listed with its engine, and its dashboard status row shows Advisor agent and Database proxy as Active.

Select database server picker listing the connected PostgreSQL and MySQL instances, including Demo Cloud SQL PostgreSQL

The Select database server picker lists connected PostgreSQL and MySQL instances.

Point your application at the proxy

Update your application's connection strings to point at the DBO proxy instead of directly at Cloud SQL, and keep the rest of the connection parameters unchanged.

See Connecting client applications for connection string details.

Your databases are detected as traffic arrives, and the proxy starts in passthrough mode: monitoring your workload and collecting projected hit rate, projected cache hits, and projected database time savings without caching anything.

Enable caching

When the projections justify it, open the database's Caching section and enable caching in Auto mode (recommended).

See Caching for modes and rule configuration.

Next steps


Did this page help you?