Skip to main content

Triage and Remediation

Remediation

Using Console

To remediate the “Point In Time Restore Should Be Enabled” misconfiguration in GCP using GCP console, please follow these steps:
  1. Login to the GCP console (console.cloud.google.com).
  2. Navigate to the Cloud SQL instances page.
  3. Select the instance that you want to remediate.
  4. Click on the Edit button at the top of the page.
  5. Scroll down to the Backup section.
  6. Under the Backup Configuration section, select the checkbox for Enable automatic backups.
  7. Under the Backup Configuration section, select the checkbox for Enable point-in-time recovery.
  8. Set the Backup retention period to the desired value.
  9. Click on the Save button at the bottom of the page.
Once you have completed these steps, automatic backups and point-in-time recovery will be enabled for your Cloud SQL instance, and you will have remediated the “Point In Time Restore Should Be Enabled” misconfiguration.

To remediate the misconfiguration “Point In Time Restore Should Be Enabled” for GCP using GCP CLI, please follow the below steps:
  1. Open the Cloud Shell in the GCP Console.
  2. Run the following command to enable point-in-time recovery for all the Cloud SQL instances in the current project:
Replace INSTANCE_NAME with the name of your Cloud SQL instance and REGION with the region where your instance is located. The —backup-start-time flag specifies the time of day when automated backups should start, and the —enable-point-in-time-recovery flag enables point-in-time recovery.
  1. Verify that point-in-time recovery is enabled for the instance by running the following command:
The output should include the following line:
This indicates that point-in-time recovery is enabled for the instance.
  1. Repeat the above steps for all the Cloud SQL instances in your project.
By following the above steps, you should be able to remediate the misconfiguration “Point In Time Restore Should Be Enabled” for GCP using GCP CLI.
To remediate the “Point In Time Restore Should Be Enabled” misconfiguration in GCP using Python, follow these steps:
  1. Import the necessary libraries:
  1. Create a BigQuery client object:
  1. Get the dataset and table objects:
  1. Get the table metadata:
  1. Check if the table has point-in-time recovery enabled:
  1. If point-in-time recovery is not enabled, enable it:
  1. Verify that point-in-time recovery has been enabled:
This Python code will enable point-in-time recovery for a BigQuery table in GCP. You can modify it as per your specific requirements.
This enables automatic backups and binary logging on the Cloud SQL instance so it can be restored to a recent point in time; these changes are in-place and do not force replacement of the instance.To verify, terraform plan should show the existing google_sql_database_instance updating with backup_configuration.enabled changing to true and backup_configuration.binary_log_enabled changing to true (and start_time if you set it).