Skip to main content

More Info:

Ensure that SQL Instances are have storageAutoResize set to True

Risk Level

Medium

Address

Performance Efficiency

Compliance Standards

  • APRA CPS 234 (Australia)
  • BSI C5 (Germany)
  • Brazil LGPD
  • CCPA / CPRA (California)
  • CIS Critical Security Controls v8
  • CMMC 2.0
  • CSA Cloud Controls Matrix v4
  • Cloudanix Best Practice
  • DPDPA
  • Digital Operational Resilience Act (EU)
  • Essential 8
  • ISO/IEC 27017
  • ISO/IEC 27018
  • ISO/IEC 27701
  • KSA PDPL
  • MAS Technology Risk Management (Singapore)
  • MITRE ATT&CK (Cloud)
  • NIS2 Directive
  • NIST SP 800-171
  • NYDFS 23 NYCRR 500
  • SWIFT Customer Security Controls Framework
  • Sarbanes-Oxley IT General Controls
  • UK NCSC Cyber Assessment Framework

Triage and Remediation

Remediation

Using Console

Sure, here are the step-by-step instructions to remediate the SQL instance storage auto-resize misconfiguration in GCP:
  1. Open the Google Cloud Console and navigate to the SQL instances page.
  2. Select the SQL instance that needs to be remediated.
  3. Click on the “Edit” button at the top of the page.
  4. Scroll down to the “Storage” section and click on the “Edit” button next to “Storage autoresize”.
  5. Toggle the switch to the right to enable storage autoresize.
  6. Set the maximum storage size limit, if required.
  7. Click on the “Save” button at the bottom of the page to save the changes.
Once the above steps are completed, the SQL instance will have storage autoresize enabled and will automatically increase the storage capacity when required.

To remediate the misconfiguration “SQL Instances should have Storage Auto Resize Enabled” for GCP using GCP CLI, follow these steps:
  1. Open the Cloud Shell on the Google Cloud Platform Console.
  2. Run the following command to list all the SQL instances in your project:
  3. Select the instance that you want to remediate and run the following command to enable storage auto resize for that instance:
    Replace INSTANCE_NAME with the name of the instance that you want to remediate.
  4. Verify that the storage auto resize is enabled for the instance by running the following command:
    Replace INSTANCE_NAME with the name of the instance that you remediated. If the output shows storageAutoResize: true, then the remediation was successful.
That’s it! You have successfully remediated the misconfiguration “SQL Instances should have Storage Auto Resize Enabled” for GCP using GCP CLI.
To remediate the misconfiguration “SQL Instances should have Storage Auto Resize Enabled” for GCP using Python, follow the steps below:
  1. Install the google-cloud-sql library using pip:
  1. Import the necessary modules:
  1. Set up the authentication by creating a service account and downloading the JSON key file. Then, create a credentials object using the JSON key file:
  1. Create a sql_v1beta4.CloudSqlClient object using the credentials object:
  1. Get the list of SQL instances using the list() method of the client.instances() object:
Replace my-project-id with your GCP project ID and us-central1-a with the location of your SQL instances. 6. Loop through the list of instances and check if the settings.storageAutoResize property is set to True. If not, enable it using the patch() method of the client.instances() object:
Replace my-project-id with your GCP project ID.This code will enable storage auto resize for all SQL instances in the specified project and location that do not already have it enabled.
Changing disk_autoresize from false to true is an in-place update and does not force replacement of the instance.Verification: terraform plan should show an in-place change on google_sql_database_instance.PRIMARY_INSTANCE with settings.0.disk_autoresize changing from false (or unset) to true (and any disk_autoresize_limit you specify).