Find and set maintenance windows

This page has procedures for finding and setting maintenance windows for Cloud SQL instances. To learn more about how and why Cloud SQL performs maintenance, see the Overview of maintenance on Cloud SQL instances.

Before you begin

  1. Sign in to your Google Cloud account. If you're new to Google Cloud, create an account to evaluate how our products perform in real-world scenarios. New customers also get $300 in free credits to run, test, and deploy workloads.
  2. In the Google Cloud console, on the project selector page, select or create a Google Cloud project.

    Go to project selector

  3. Make sure that billing is enabled for your Google Cloud project. Learn how to check if billing is enabled on a project.

  4. Install the Google Cloud CLI.
  5. To initialize the gcloud CLI, run the following command:

    gcloud init
  6. In the Google Cloud console, on the project selector page, select or create a Google Cloud project.

    Go to project selector

  7. Make sure that billing is enabled for your Google Cloud project. Learn how to check if billing is enabled on a project.

  8. Install the Google Cloud CLI.
  9. To initialize the gcloud CLI, run the following command:

    gcloud init

Set a preferred window for maintenance on an instance

Console

  1. In the Google Cloud console, go to the Cloud SQL Instances page.

    Go to Cloud SQL Instances

  2. To open the Overview page of an instance, click the instance name.
  3. In the Maintenance section, click Edit maintenance preferences.
  4. In the Configuration options section, open Maintenance.
  5. Configure the following options:
    • Preferred window. Set the day and hour range when updates can occur on this instance.
    • Order of update. Set the order for updating this instance, in relation to updates to other instances. Set the timing to Any, Earlier, or Later. Instances using the Earlier setting receive updates up to a week before instances using the Later setting, when comparing instances that reside in the same location.

gcloud

Before using the gcloud command below, make the following replacements:

  • instance-id: Instance to reschedule
  • day: Day when you want maintenance to occur. Set to one of SUN, MON, TUE, WED, THU, FRI, SAT.
  • hour: Hour of day for maintenance window, in UTC time zone (0-23).
gcloud sql instances patch instance-id \
--maintenance-window-day=day \
--maintenance-window-hour=hour
    
For reference information, see gcloud sql instances patch.