Edit instances

This page describes how to edit an existing Cloud SQL instance.

After you create an instance, you can edit it while it's running to change its settings. For information about instance settings and how changing settings can impact an instance, see Instance Settings.

Edit an instance

Most edits can be applied to an instance only when it's running.

Console

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

    Go to Cloud SQL Instances

  2. Click the instance name to open its Overview page.
  3. Click Edit.
  4. In the Configuration options section, update editable settings for your instance.
    Setting Notes
    Machine type
    Machine type Select from Shared core, Lightweight, Standard (Most common), or High memory.
    Custom Select this button to create an instance with a flexible configuration. When you select this option, you need to select the number of cores and amount of memory for your instance. Learn more.
    Cores The number of vCPUs for your instance. Learn more.
    Memory The amount of memory for your instance, in GBs. Learn more.
    Storage
    Storage type Determines whether your instance uses SSD or HDD storage. Learn more.
    Storage capacity The amount of storage provisioned for the instance. Learn more.
    Enable automatic storage increases Determines whether Cloud SQL automatically provides more storage for your instance when free space runs low. Learn more.
    Encryption
    Google-managed encryptionThe default option.
    Customer key-managed encryption key (CMEK)Select to use your key with Google Cloud Key Management Service. Learn more.
    Connectivity
    Private IP Adds a private IP address for your instance. To enable connecting to the instance, additional configuration is required. Learn more.
    Public IP Adds a public IP address for your instance. You can then add authorized networks to connect to the instance. Learn more.
    Authorized networksAdd the name for the new network and the Network address. Learn more.
    Backups
    Automate backups The window of time when you would like backups to start. Learn more.
    Choose where to store your backupsSelect Multi-region for most use cases. If you need to store backups in a specific region, for example, if there are regulatory reasons to do so, select Region and select your region from the Location drop-down menu.
    Choose how many automated backups to storeThe number of automated backups you would like to retain (from 1 to 365 days). Learn more.
    Enable point-in-time recovery Enables point-in-time recovery and write-ahead logging. Learn more.
    Choose how many days of logs to retain Configure write-ahead log retention from 1 to 7 days. The default setting is 7 days. Learn more.
    Maintenance
    Preferred window Determines a one-hour window when Cloud SQL can perform disruptive maintenance on your instance. If you do not set the window, then disruptive maintenance can be done at any time. Learn more.
    Order of updates Your preferred timing for instance updates, relative to other instances in the same project. Learn more.
    Flags
    ADD FLAG You can use database flags to control settings and parameters for your instance. Learn more.
    Labels
    ADD LABELAdd a key and value for each label that you add. You use labels to help organize your instances.

    Learn more about instance settings.

  5. Click Save to apply your changes.

gcloud

The following command modifies the backup start time.

gcloud sql instances patch INSTANCE_NAME \
--backup-start-time 16:00

If the patch modifies a value that requires a restart, you will see a prompt to proceed with the change or cancel.

REST v1

The following command modifies the backup start time.

Before using any of the request data, make the following replacements:

  • project-id: The project ID
  • instance-id: The instance ID

HTTP method and URL:

PATCH https://sqladmin.googleapis.com/v1/projects/project-id/instances/instance-id

Request JSON body:

{
  "settings": {
    "backupConfiguration": {
      "startTime": "16:00",
      "enabled": true,
      "binaryLogEnabled": true
    }
  }
}

To send your request, expand one of these options:

You should receive a JSON response similar to the following:

{
  "kind": "sql#operation",
  "targetLink": "https://sqladmin.googleapis.com/v1/projects/project-id/instances/instance-id",
  "status": "PENDING",
  "user": "user@example.com",
  "insertTime": "2020-01-16T02:32:12.281Z",
  "operationType": "UPDATE",
  "name": "operation-id",
  "targetId": "instance-id",
  "selfLink": "https://sqladmin.googleapis.com/v1/projects/project-id/operations/operation-id",
  "targetProject": "project-id"
}

If the patch modifies a value that requires a restart, you will see a prompt to proceed with the change or cancel.

REST v1beta4

The following command modifies the backup start time.

Before using any of the request data, make the following replacements:

  • project-id: The project ID
  • instance-id: The instance ID

HTTP method and URL:

PATCH https://sqladmin.googleapis.com/sql/v1beta4/projects/project-id/instances/instance-id

Request JSON body:

{
  "settings": {
    "backupConfiguration": {
      "startTime": "16:00",
      "enabled": true,
      "binaryLogEnabled": true
    }
  }
}

To send your request, expand one of these options:

You should receive a JSON response similar to the following:

{
  "kind": "sql#operation",
  "targetLink": "https://sqladmin.googleapis.com/sql/v1beta4/projects/project-id/instances/instance-id",
  "status": "PENDING",
  "user": "user@example.com",
  "insertTime": "2020-01-16T02:32:12.281Z",
  "operationType": "UPDATE",
  "name": "operation-id",
  "targetId": "instance-id",
  "selfLink": "https://sqladmin.googleapis.com/sql/v1beta4/projects/project-id/operations/operation-id",
  "targetProject": "project-id"
}

If the patch modifies a value that requires a restart, you will see a prompt to proceed with the change or cancel.

To see how the underlying REST API request is constructed for this task, see the APIs Explorer on the instances:patch page.