Remediation
From Google Cloud Console
- Go to the Cloud SQL Instances page in the Google Cloud Console by visiting https://console.cloud.google.com/sql/instances.
- Select the instance where the backups need to be configured.
- Click
Edit. - In the
Backupssection, checkEnable automated backups, and choose a backup window. - Click
Save.
From Google Cloud CLI
-
List all Cloud SQL database instances using the following command:
gcloud sql instances list \
--format=json | jq '. | map(select(.instanceType != "{{read-replica-instance}}")) | .[].name'NOTE: gcloud command has been added with the filter to exclude read-replicas instances, as GCP do not provide Automated Backups for read-replica instances.
-
Enable Automated backups for every Cloud SQL database instance using the below command:
gcloud sql instances patch {{instance-name}} \
--backup-start-time {{backup-start-time}}The
backup-start-timeparameter is specified in 24-hour time, in the UTC±00 time zone, and specifies the start of a 4-hour backup window. Backups can start any time during the backup window.