Overview
It is recommended to have all SQL database instances set to enable automated backups.
Rationale
Backups provide a way to restore a Cloud SQL instance to recover lost data or recover from a problem with that instance. Automated backups need to be set for any instance that contains data that should be protected from loss or damage. This recommendation is applicable for SQL Server, PostgreSql, MySql generation 1 and MySql generation 2 instances.
Impact
Automated Backups will increase required size of storage and costs associated with it.
Remediation guidance
From Google Cloud Console
- Go to the
Cloud SQL Instancespage 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, selectEditunderSettings - Check
Automate daily backupsand fill in the required settings. - Click
SAVE.
From Google Cloud CLI
- List all Cloud SQL database instances using the following command:
gcloud sql instances list
- Enable
Automated backupsfor every Cloud SQL database instance using the below command:
gcloud sql instances patch <instanceName> --backup-start-time
Note
The backup-start-time parameter 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.
Default Value
By default, automated backups are not configured for Cloud SQL instances. Data backup is not possible on any Cloud SQL instance unless Automated Backup is configured.
References
- https://cloud.google.com/sql/docs/mysql/backup-recovery/backups
- https://cloud.google.com/sql/docs/postgres/backup-recovery/backing-up
Service-wide remediation
Recommended when many resources are affected: fix the platform baseline first so new resources inherit the secure setting, then remediate the existing flagged resources in batches.
Google Cloud
Use organization or folder policies where available, shared project templates, logs and alerting baselines, and IaC modules so new resources inherit the secure setting.
Operational rollout
- Fix the baseline first at the account, subscription, project, cluster, or tenant scope that owns this control.
- Remediate the currently affected resources in batches, starting with internet-exposed and production assets.
- Re-scan and track approved exceptions with an owner and expiry date.
Query logic
These are the stored checks tied to this control.
Cloud SQL database instances are configured with automated backups
Connectors
Covered asset types
Expected check: eq []
cloudSqlInstances(where:{settingsBackupConfigurationEnabled:false}){...AssetFragment}
Google Cloud