Other Articles

Cloud SQL – Enable Automated Backups

This check ensures that automated backups are enabled for Cloud SQL instances. Automated backups protect databases from data loss, corruption, and accidental deletion.

Check Details

  • Resource: Cloud SQL
  • Check: Configure automated backups
  • Risk: Without automated backups, database data cannot be recovered in the event of accidental deletion, corruption, or system failure, leading to data loss and service downtime.

Remediation via Google Cloud Console

  1. Log in to the Google Cloud Console and navigate to Cloud SQL. Cloud Sql Instance
  2. Click on the affected Cloud SQL instance.
  3. Click Edit to modify the instance configuration. Cloud Sql Instance Edit
  4. Scroll to the Backups section under Storage tab. Backup Cloud Sql Instance
  5. Enable Automated backups and select a preferred backup window.
  6. Click Save to apply the changes.

Remediation via Google Cloud CLI

  1. Open the Google Cloud Console and launch Cloud Shell. GCP Cloud Shell
  2. List all Cloud SQL instances excluding read replicas:
    
    gcloud sql instances list --format=json | \
    jq '. | map(select(.instanceType != "READ_REPLICA_INSTANCE")) | .[].name'
    
  3. Enable automated backups for a Cloud SQL instance:
    
    gcloud sql instances patch <INSTANCE_NAME> \
    --backup-start-time <HH:MM>
    

Replace <INSTANCE_NAME> with the Cloud SQL instance name. The --backup-start-time value must be specified in 24-hour format (UTC) and defines the start of a 4-hour backup window.

Default Value

By default, automated backups are not enabled for Cloud SQL instances. Backup and point-in-time recovery are not available unless automated backups are configured.