Delete instances

This page describes how to delete Cloud SQL instances.

Note the following when you plan to delete an instance:

  • You cannot delete an instance that has any replicas. You must delete all replicas first.
  • After you delete an instance, it might continue to appear in your project with an "unknown" size but with a "Being deleted" status. This is normal and the instance disappears completely after a brief period of time.
  • It can take up to a week for the underlying resources related to an instance to be completely deleted, with the exception of read replicas, which are often deleted within a few minutes.
  • The deleted instance name can be reused immediately to create a new instance.
  • If deletion protection is enabled on an instance, you must disable it before deleting the instance.

Required permissions

By default, only user or service accounts with the Cloud SQL Admin (roles/cloudsql.admin) or Owner (roles/owner) role have the permission to delete a Cloud SQL instance (cloudsql.instances.delete).

You can also define an IAM custom role for the user or service account that includes the cloudsql.instances.delete permission. This permission is supported in IAM custom roles.

Delete an instance

Before attempting to delete an instance, confirm that it is safe to do so. Then confirm that deletion protection is disabled.

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. Click Delete.
  4. In the Delete database instance dialog box, click OK.

gcloud

Delete the instance.

gcloud sql instances delete INSTANCE_NAME

REST v1

Delete the instance.

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:

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

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/var>instance-id",
  "status": "PENDING",
  "user": "user@example.com",
  "insertTime": "2020-01-15T00:10:22.078Z",
  "operationType": "DELETE",
  "name": "operation-id",
  "targetId": "instance-id",
  "selfLink": "https://sqladmin.googleapis.com/v1/projects/project-id/operations/operation-id",
  "targetProject": "project-id"
}

REST v1beta4

Delete the instance.

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:

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

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/var>instance-id",
  "status": "PENDING",
  "user": "user@example.com",
  "insertTime": "2020-01-15T00:10:22.078Z",
  "operationType": "DELETE",
  "name": "operation-id",
  "targetId": "instance-id",
  "selfLink": "https://sqladmin.googleapis.com/sql/v1beta4/projects/project-id/operations/operation-id",
  "targetProject": "project-id"
}
To see how the underlying REST API request is constructed for this task, see the APIs Explorer on the instances:delete page.