Google Cloud SQL · autoscaling

Right-size Cloud SQL to what it actually uses.

CloudSQL Autoscaler reads three days of CPU and memory metrics, finds the sustained load with P95 percentiles, and safely resizes each instance to the machine type it truly needs — up or down.

Get started and run $ cloudsql-autoscaler --project prod
Autoscaler scaling
db-01 db-02 +3 instances ▸db-n2-standard-8
CPU utilization P95
−$0/mo
project acme-prod interval 30m profile default dry-run off
How it works

Measure, decide, resize — on a loop.

Every cycle turns raw Cloud Monitoring data into a single, safe decision per instance.

01

Collect

Pulls three days of CPU and memory time series from Cloud Monitoring for every instance in the project.

02

Analyze

Computes P95 percentiles to separate sustained pressure from short-lived spikes, then checks it against your profile.

03

Right-size

Steps the machine type up or down and applies it when you opt in, honoring each edition's downtime rules.

Features

Built to touch production databases carefully.

Smart P95 analysis

Three days of metrics and P95 percentiles identify real sustained load, so a nightly batch spike never triggers a resize.

Downtime aware

Distinguishes Enterprise Plus near-zero-downtime windows from Enterprise edition restarts before it changes anything.

CLI · Docker · Kubernetes

Run it once from your laptop, on a schedule in a container, or as an always-on daemon with GKE Workload Identity.

Scaling profiles

Pick conservative, default, or aggressive to tune how eagerly it resizes.

Observable

Prometheus metrics plus /health, /ready, and /status endpoints make daemon mode easy to watch.

Safe by default

Every run is a dry run until you pass --dry-run=false. Preview recommendations as a table or JSON first.

Deploy

Ship it however you run infrastructure.

CLI
# install
go install github.com/fraser-isbester/\
  cloudsql-autoscaler/cmd/cloudsql-autoscaler@latest

# analyze (dry-run)
cloudsql-autoscaler --project my-project

# apply
cloudsql-autoscaler --project my-project \
  --dry-run=false
Docker
# run as a daemon
docker run -d \
  -e GOOGLE_APPLICATION_CREDENTIALS=/creds.json \
  -v /path/creds.json:/creds.json:ro \
  ghcr.io/fraser-isbester/\
    cloudsql-autoscaler:latest \
  --daemon --project my-project
Kubernetes
# clone and deploy
git clone https://github.com/fraser-isbester/\
  cloudsql-autoscaler.git
cd cloudsql-autoscaler
make deploy-k8s

# check status
make k8s-status
Needs GKE Workload Identity + a service account with Cloud SQL Admin.
GET /health GET /ready GET /status GET /metrics

Stop guessing at machine types.

Point it at a project and see what your Cloud SQL fleet should actually be running — no changes until you say so.