Skip to main content
rightsizing · gcp

Dev and test Cloud SQL instances retaining more than 7 automated backups

resource types
1
rule IDs covered
1
severity
low

What does ZopNight detect here?

Cloud SQL keeps 7 automated backups by default on Enterprise edition, and every extra backup adds billed backup storage. ZopNight flags dev, test, QA, staging and sandbox instances retaining more than 7, and prices the saving from the chargeable backup bytes that trimming retention back to 7 would remove, at Cloud SQL's backup storage rate.

Signal and threshold

How ZopNight evaluates Dev and test Cloud SQL instances retaining more than 7 automated backups.
Field Value
Rule IDsRC-147
Categoryrightsizing
Severitylow
Metricnone — pure configuration read
Thresholdretained backups > 7 on a dev/test instance
SourceZopNight
Permissions usedcloudsql.instances.list · cloudsql.instances.get · cloudsql.backupRuns.list

Every retained backup adds to the storage line

Cloud SQL bills backups by the gigabyte: the pricing page lists “Backups (used)” as its own storage item, separate from the instance’s SSD or HDD capacity. Backups are incremental. Google’s backup overview explains that the oldest backup is roughly the size of the database and later ones hold only changes, so a busy dev database that retains many backups carries many days of churn.

The default is modest. The gcloud reference sets --retained-backups-count to 7 for Enterprise edition and 15 for Enterprise Plus, with a valid range of 1 to 365. Development databases configured by copying a production template often inherit a much longer setting.

Seeing retention per instance

Terminal window
gcloud sql instances list \
--format="table(name,settings.backupConfiguration.backupRetentionSettings.retainedBackups)"
gcloud sql backups list --instance=INSTANCE_NAME

What makes a Cloud SQL instance a candidate

Production is ruled out first: a production-looking name or env=prod style label ends the check. Then ZopNight needs positive dev or test evidence, from a name containing dev, test, qa, staging, sandbox or demo or an environment label. Finally the instance must retain more than 7 backups.

Instances with no finding

The saving is priced from measured data, so ZopNight also needs the instance’s chargeable backup bytes and a Cloud SQL backup storage rate for its region. Without either, it stays silent rather than guessing. Production retention is a policy decision this rule does not second-guess.

Backup bytes above the 7-backup line

Terminal window
removed fraction = (retained backups - 7) / retained backups
saving = removed fraction x chargeable backup GiB x backup rate per GiB-hour x 730,
capped at the instance's cost

The rate is the dedicated backup storage rate, not the data disk rate, which is higher.

Trimming retention on a dev database

  1. Confirm no test plan depends on restoring from a backup older than a week.
  2. Set the count back to the default: gcloud sql instances patch INSTANCE_NAME --retained-backups-count=7.
  3. Leave point-in-time recovery settings as they are unless you mean to change them; transaction log retention is a separate setting.
  4. For data you must keep longer, take an on-demand backup, which is kept until you delete it.

See it fire on your bill.

Connect an account read-only. The first findings land in minutes.

472 rule families across 353 resource types on 22 platforms. Every threshold, metric, and IAM action is documented on these pages before you grant anything.

472 rule families documented
353 resource types covered
read-only default access level
Multi-cloud automation· Production-ready in 30 min· SOC 2 · ISO 27001· 20–60% off the bill, first month· 4 platforms · 1 console· Multi-cloud automation· Production-ready in 30 min· SOC 2 · ISO 27001· 20–60% off the bill, first month· 4 platforms · 1 console·