instances
Creates, updates, deletes, gets or lists an instances resource.
Overview
| Name | instances |
| Type | Resource |
| Id | google.sqladmin.instances |
Fields
The following fields are returned by SELECT queries:
- get
- list
| Name | Datatype | Description |
|---|---|---|
name | string | Name of the Cloud SQL instance. This does not include the project ID. |
availableMaintenanceVersions | array | Output only. List all maintenance versions applicable on the instance |
backendType | string | The backend type. SECOND_GEN: Cloud SQL database instance. EXTERNAL: A database server that is not managed by Google. This property is read-only; use the tier property in the settings object to determine the database type. |
connectionName | string | Connection name of the Cloud SQL instance used in connection strings. |
createTime | string (google-datetime) | Output only. The time when the instance was created in RFC 3339 format, for example 2012-11-15T16:19:00.094Z. |
currentDiskSize | string (int64) | The current disk usage of the instance in bytes. This property has been deprecated. Use the "cloudsql.googleapis.com/database/disk/bytes_used" metric in Cloud Monitoring API instead. Please see this announcement for details. |
databaseInstalledVersion | string | Output only. Stores the current database version running on the instance including minor version such as MYSQL_8_0_18. |
databaseVersion | string | The database engine type and version. The databaseVersion field cannot be changed after instance creation. |
diskEncryptionConfiguration | object | Disk encryption configuration specific to an instance. (id: DiskEncryptionConfiguration) |
diskEncryptionStatus | object | Disk encryption status specific to an instance. (id: DiskEncryptionStatus) |
dnsName | string | Output only. The dns name of the instance. |
dnsNames | array | Output only. The list of DNS names used by this instance. |
etag | string | This field is deprecated and will be removed from a future version of the API. Use the settings.settingsVersion field instead. |
failoverReplica | object | The name and status of the failover replica. |
gceZone | string | The Compute Engine zone that the instance is currently serving from. This value could be different from the zone that was specified when the instance was created if the instance has failed over to its secondary zone. WARNING: Changing this might restart the instance. |
geminiConfig | object | Gemini instance configuration. (id: GeminiInstanceConfig) |
includeReplicasForMajorVersionUpgrade | boolean | Input only. Determines whether an in-place major version upgrade of replicas happens when an in-place major version upgrade of a primary instance is initiated. |
instanceType | string | The instance type. |
ipAddresses | array | The assigned IP addresses for the instance. |
ipv6Address | string | The IPv6 address assigned to the instance. (Deprecated) This property was applicable only to First Generation instances. |
kind | string | This is always sql#instance. |
maintenanceVersion | string | The current software version on the instance. |
masterInstanceName | string | The name of the instance which will act as primary in the replication setup. |
maxDiskSize | string (int64) | The maximum disk size of the instance in bytes. |
nodeCount | integer (int32) | The number of read pool nodes in a read pool. |
nodes | array | Output only. Entries containing information about each read pool node of the read pool. |
onPremisesConfiguration | object | Configuration specific to on-premises instances. (id: OnPremisesConfiguration) |
outOfDiskReport | object | This field represents the report generated by the proactive database wellness job for OutOfDisk issues. * Writers: * the proactive database wellness job for OOD. * Readers: * the proactive database wellness job (id: SqlOutOfDiskReport) |
primaryDnsName | string | Output only. DEPRECATED: please use write_endpoint instead. |
project | string | The project ID of the project containing the Cloud SQL instance. The Google apps domain is prefixed if applicable. |
pscServiceAttachmentLink | string | Output only. The link to service attachment of PSC instance. |
region | string | The geographical region of the Cloud SQL instance. It can be one of the regions where Cloud SQL operates: For example, asia-east1, europe-west1, and us-central1. The default value is us-central1. |
replicaConfiguration | object | Configuration specific to failover replicas and read replicas. (id: ReplicaConfiguration) |
replicaNames | array | The replicas of the instance. |
replicationCluster | object | Optional. A primary instance and disaster recovery (DR) replica pair. A DR replica is a cross-region replica that you designate for failover in the event that the primary instance experiences regional failure. Applicable to MySQL and PostgreSQL. (id: ReplicationCluster) |
rootPassword | string | Initial root password. Use only on creation. You must set root passwords before you can connect to PostgreSQL instances. |
satisfiesPzi | boolean | Output only. This status indicates whether the instance satisfies PZI. The status is reserved for future use. |
satisfiesPzs | boolean | This status indicates whether the instance satisfies PZS. The status is reserved for future use. |
scheduledMaintenance | object | The start time of any upcoming scheduled maintenance for this instance. (id: SqlScheduledMaintenance) |
secondaryGceZone | string | The Compute Engine zone that the failover instance is currently serving from for a regional instance. This value could be different from the zone that was specified when the instance was created if the instance has failed over to its secondary/failover zone. |
selfLink | string | The URI of this resource. |
serverCaCert | object | SSL configuration. (id: SslCert) |
serviceAccountEmailAddress | string | The service account email address assigned to the instance.\This property is read-only. |
settings | object | The user settings. (id: Settings) |
sqlNetworkArchitecture | string | |
state | string | The current serving state of the Cloud SQL instance. |
suspensionReason | array | If the instance state is SUSPENDED, the reason for the suspension. |
switchTransactionLogsToCloudStorageEnabled | boolean | Input only. Whether Cloud SQL is enabled to switch storing point-in-time recovery log files from a data disk to Cloud Storage. |
tags | object | Optional. Input only. Immutable. Tag keys and tag values that are bound to this instance. You must represent each item in the map as: "" : "". For example, a single resource can have the following tags: "123/environment": "production", "123/costCenter": "marketing", For more information on tag creation and management, see https://cloud.google.com/resource-manager/docs/tags/tags-overview. |
upgradableDatabaseVersions | array | Output only. All database versions that are available for upgrade. |
writeEndpoint | string | Output only. The dns name of the primary instance in a replication group. |
| Name | Datatype | Description |
|---|---|---|
name | string | Name of the Cloud SQL instance. This does not include the project ID. |
availableMaintenanceVersions | array | Output only. List all maintenance versions applicable on the instance |
backendType | string | The backend type. SECOND_GEN: Cloud SQL database instance. EXTERNAL: A database server that is not managed by Google. This property is read-only; use the tier property in the settings object to determine the database type. |
connectionName | string | Connection name of the Cloud SQL instance used in connection strings. |
createTime | string (google-datetime) | Output only. The time when the instance was created in RFC 3339 format, for example 2012-11-15T16:19:00.094Z. |
currentDiskSize | string (int64) | The current disk usage of the instance in bytes. This property has been deprecated. Use the "cloudsql.googleapis.com/database/disk/bytes_used" metric in Cloud Monitoring API instead. Please see this announcement for details. |
databaseInstalledVersion | string | Output only. Stores the current database version running on the instance including minor version such as MYSQL_8_0_18. |
databaseVersion | string | The database engine type and version. The databaseVersion field cannot be changed after instance creation. |
diskEncryptionConfiguration | object | Disk encryption configuration specific to an instance. (id: DiskEncryptionConfiguration) |
diskEncryptionStatus | object | Disk encryption status specific to an instance. (id: DiskEncryptionStatus) |
dnsName | string | Output only. The dns name of the instance. |
dnsNames | array | Output only. The list of DNS names used by this instance. |
etag | string | This field is deprecated and will be removed from a future version of the API. Use the settings.settingsVersion field instead. |
failoverReplica | object | The name and status of the failover replica. |
gceZone | string | The Compute Engine zone that the instance is currently serving from. This value could be different from the zone that was specified when the instance was created if the instance has failed over to its secondary zone. WARNING: Changing this might restart the instance. |
geminiConfig | object | Gemini instance configuration. (id: GeminiInstanceConfig) |
includeReplicasForMajorVersionUpgrade | boolean | Input only. Determines whether an in-place major version upgrade of replicas happens when an in-place major version upgrade of a primary instance is initiated. |
instanceType | string | The instance type. |
ipAddresses | array | The assigned IP addresses for the instance. |
ipv6Address | string | The IPv6 address assigned to the instance. (Deprecated) This property was applicable only to First Generation instances. |
kind | string | This is always sql#instance. |
maintenanceVersion | string | The current software version on the instance. |
masterInstanceName | string | The name of the instance which will act as primary in the replication setup. |
maxDiskSize | string (int64) | The maximum disk size of the instance in bytes. |
nodeCount | integer (int32) | The number of read pool nodes in a read pool. |
nodes | array | Output only. Entries containing information about each read pool node of the read pool. |
onPremisesConfiguration | object | Configuration specific to on-premises instances. (id: OnPremisesConfiguration) |
outOfDiskReport | object | This field represents the report generated by the proactive database wellness job for OutOfDisk issues. * Writers: * the proactive database wellness job for OOD. * Readers: * the proactive database wellness job (id: SqlOutOfDiskReport) |
primaryDnsName | string | Output only. DEPRECATED: please use write_endpoint instead. |
project | string | The project ID of the project containing the Cloud SQL instance. The Google apps domain is prefixed if applicable. |
pscServiceAttachmentLink | string | Output only. The link to service attachment of PSC instance. |
region | string | The geographical region of the Cloud SQL instance. It can be one of the regions where Cloud SQL operates: For example, asia-east1, europe-west1, and us-central1. The default value is us-central1. |
replicaConfiguration | object | Configuration specific to failover replicas and read replicas. (id: ReplicaConfiguration) |
replicaNames | array | The replicas of the instance. |
replicationCluster | object | Optional. A primary instance and disaster recovery (DR) replica pair. A DR replica is a cross-region replica that you designate for failover in the event that the primary instance experiences regional failure. Applicable to MySQL and PostgreSQL. (id: ReplicationCluster) |
rootPassword | string | Initial root password. Use only on creation. You must set root passwords before you can connect to PostgreSQL instances. |
satisfiesPzi | boolean | Output only. This status indicates whether the instance satisfies PZI. The status is reserved for future use. |
satisfiesPzs | boolean | This status indicates whether the instance satisfies PZS. The status is reserved for future use. |
scheduledMaintenance | object | The start time of any upcoming scheduled maintenance for this instance. (id: SqlScheduledMaintenance) |
secondaryGceZone | string | The Compute Engine zone that the failover instance is currently serving from for a regional instance. This value could be different from the zone that was specified when the instance was created if the instance has failed over to its secondary/failover zone. |
selfLink | string | The URI of this resource. |
serverCaCert | object | SSL configuration. (id: SslCert) |
serviceAccountEmailAddress | string | The service account email address assigned to the instance.\This property is read-only. |
settings | object | The user settings. (id: Settings) |
sqlNetworkArchitecture | string | |
state | string | The current serving state of the Cloud SQL instance. |
suspensionReason | array | If the instance state is SUSPENDED, the reason for the suspension. |
switchTransactionLogsToCloudStorageEnabled | boolean | Input only. Whether Cloud SQL is enabled to switch storing point-in-time recovery log files from a data disk to Cloud Storage. |
tags | object | Optional. Input only. Immutable. Tag keys and tag values that are bound to this instance. You must represent each item in the map as: "" : "". For example, a single resource can have the following tags: "123/environment": "production", "123/costCenter": "marketing", For more information on tag creation and management, see https://cloud.google.com/resource-manager/docs/tags/tags-overview. |
upgradableDatabaseVersions | array | Output only. All database versions that are available for upgrade. |
writeEndpoint | string | Output only. The dns name of the primary instance in a replication group. |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get | select | project, instance | Retrieves a resource containing information about a Cloud SQL instance. | |
list | select | project | filter, maxResults, pageToken | Lists instances under a given project. |
insert | insert | project | Creates a new Cloud SQL instance. | |
patch | update | project, instance | Partially updates settings of a Cloud SQL instance by merging the request with the current configuration. This method supports patch semantics. | |
update | replace | project, instance | Updates settings of a Cloud SQL instance. Using this operation might cause your instance to restart. | |
delete | delete | project, instance | enableFinalBackup, finalBackupDescription, finalBackupTtlDays, finalBackupExpiryTime | Deletes a Cloud SQL instance. |
pre_check_major_version_upgrade | exec | project, instance | Execute MVU Pre-checks | |
execute_sql | exec | project, instance | Execute SQL statements. | |
list_entra_id_certificates | exec | project, instance | Lists all versions of EntraID certificates for the specified instance. There can be up to three sets of certificates listed: the certificate that is currently in use, a future that has been added but not yet used to sign a certificate, and a certificate that has been rotated out. | |
rotate_server_ca | exec | project, instance | Rotates the server certificate to one signed by the Certificate Authority (CA) version previously added with the addServerCA method. For instances that have enabled Certificate Authority Service (CAS) based server CA, use RotateServerCertificate to rotate the server certificate. | |
reencrypt | exec | project, instance | Reencrypt CMEK instance with latest key version. | |
clone | exec | project, instance | Creates a Cloud SQL instance as a clone of the source instance. Using this operation might cause your instance to restart. | |
export | exec | project, instance | Exports data from a Cloud SQL instance to a Cloud Storage bucket as a SQL dump or CSV file. | |
list_server_certificates | exec | project, instance | Lists all versions of server certificates and certificate authorities (CAs) for the specified instance. There can be up to three sets of certs listed: the certificate that is currently in use, a future that has been added but not yet used to sign a certificate, and a certificate that has been rotated out. For instances not using Certificate Authority Service (CAS) server CA, use ListServerCas instead. | |
point_in_time_restore | exec | projectsId | Point in time restore for an instance managed by Google Cloud Backup and Disaster Recovery. | |
acquire_ssrs_lease | exec | project, instance | Acquire a lease for the setup of SQL Server Reporting Services (SSRS). | |
failover | exec | project, instance | Initiates a manual failover of a high availability (HA) primary instance to a standby instance, which becomes the primary instance. Users are then rerouted to the new primary. For more information, see the Overview of high availability page in the Cloud SQL documentation. If using Legacy HA (MySQL only), this causes the instance to failover to its failover replica instance. | |
reset_ssl_config | exec | project, instance | mode | Deletes all client certificates and generates a new server SSL certificate for the instance. |
promote_replica | exec | project, instance | failover | Promotes the read replica instance to be an independent Cloud SQL primary instance. Using this operation might cause your instance to restart. |
restart | exec | project, instance | Restarts a Cloud SQL instance. | |
stop_replica | exec | project, instance | Stops the replication in the read replica instance. | |
demote_master | exec | project, instance | Demotes the stand-alone instance to be a Cloud SQL read replica for an external database server. | |
switchover | exec | project, instance | dbTimeout | Switches over from the primary instance to the DR replica instance. |
truncate_log | exec | project, instance | Truncate MySQL general and slow query log tables MySQL only. | |
demote | exec | project, instance | Demotes an existing standalone instance to be a Cloud SQL read replica for an external database server. | |
restore_backup | exec | project, instance | Restores a backup of a Cloud SQL instance. Using this operation might cause your instance to restart. | |
start_replica | exec | project, instance | Starts the replication in the read replica instance. | |
rotate_server_certificate | exec | project, instance | Rotates the server certificate version to one previously added with the addServerCertificate method. For instances not using Certificate Authority Service (CAS) server CA, use RotateServerCa instead. | |
rotate_entra_id_certificate | exec | project, instance | Rotates the server certificate version to one previously added with the addEntraIdCertificate method. | |
release_ssrs_lease | exec | project, instance | Release a lease for the setup of SQL Server Reporting Services (SSRS). | |
import | exec | project, instance | Imports data into a Cloud SQL instance from a SQL dump or CSV file in Cloud Storage. | |
start_external_sync | exec | project, instance | Start External primary instance migration. | |
reset_replica_size | exec | project, instance | Reset Replica Size to primary instance disk size. | |
reschedule_maintenance | exec | project, instance | Reschedules the maintenance on the given instance. | |
verify_external_sync_settings | exec | project, instance | Verify External primary instance external sync settings. | |
perform_disk_shrink | exec | project, instance | Perform Disk Shrink on primary instance. |
Parameters
Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.
| Name | Datatype | Description |
|---|---|---|
instance | string | |
project | string | |
projectsId | string | |
dbTimeout | string (google-duration) | |
enableFinalBackup | boolean | |
failover | boolean | |
filter | string | |
finalBackupDescription | string | |
finalBackupExpiryTime | string (google-datetime) | |
finalBackupTtlDays | string (int64) | |
maxResults | integer (uint32) | |
mode | string | |
pageToken | string |
SELECT examples
- get
- list
Retrieves a resource containing information about a Cloud SQL instance.
SELECT
name,
availableMaintenanceVersions,
backendType,
connectionName,
createTime,
currentDiskSize,
databaseInstalledVersion,
databaseVersion,
diskEncryptionConfiguration,
diskEncryptionStatus,
dnsName,
dnsNames,
etag,
failoverReplica,
gceZone,
geminiConfig,
includeReplicasForMajorVersionUpgrade,
instanceType,
ipAddresses,
ipv6Address,
kind,
maintenanceVersion,
masterInstanceName,
maxDiskSize,
nodeCount,
nodes,
onPremisesConfiguration,
outOfDiskReport,
primaryDnsName,
project,
pscServiceAttachmentLink,
region,
replicaConfiguration,
replicaNames,
replicationCluster,
rootPassword,
satisfiesPzi,
satisfiesPzs,
scheduledMaintenance,
secondaryGceZone,
selfLink,
serverCaCert,
serviceAccountEmailAddress,
settings,
sqlNetworkArchitecture,
state,
suspensionReason,
switchTransactionLogsToCloudStorageEnabled,
tags,
upgradableDatabaseVersions,
writeEndpoint
FROM google.sqladmin.instances
WHERE project = '{{ project }}' -- required
AND instance = '{{ instance }}' -- required
;
Lists instances under a given project.
SELECT
name,
availableMaintenanceVersions,
backendType,
connectionName,
createTime,
currentDiskSize,
databaseInstalledVersion,
databaseVersion,
diskEncryptionConfiguration,
diskEncryptionStatus,
dnsName,
dnsNames,
etag,
failoverReplica,
gceZone,
geminiConfig,
includeReplicasForMajorVersionUpgrade,
instanceType,
ipAddresses,
ipv6Address,
kind,
maintenanceVersion,
masterInstanceName,
maxDiskSize,
nodeCount,
nodes,
onPremisesConfiguration,
outOfDiskReport,
primaryDnsName,
project,
pscServiceAttachmentLink,
region,
replicaConfiguration,
replicaNames,
replicationCluster,
rootPassword,
satisfiesPzi,
satisfiesPzs,
scheduledMaintenance,
secondaryGceZone,
selfLink,
serverCaCert,
serviceAccountEmailAddress,
settings,
sqlNetworkArchitecture,
state,
suspensionReason,
switchTransactionLogsToCloudStorageEnabled,
tags,
upgradableDatabaseVersions,
writeEndpoint
FROM google.sqladmin.instances
WHERE project = '{{ project }}' -- required
AND filter = '{{ filter }}'
AND maxResults = '{{ maxResults }}'
AND pageToken = '{{ pageToken }}'
;
INSERT examples
- insert
- Manifest
Creates a new Cloud SQL instance.
INSERT INTO google.sqladmin.instances (
data__settings,
data__masterInstanceName,
data__replicaConfiguration,
data__region,
data__satisfiesPzs,
data__includeReplicasForMajorVersionUpgrade,
data__replicationCluster,
data__connectionName,
data__etag,
data__instanceType,
data__ipv6Address,
data__selfLink,
data__rootPassword,
data__databaseVersion,
data__maintenanceVersion,
data__nodeCount,
data__project,
data__maxDiskSize,
data__state,
data__currentDiskSize,
data__tags,
data__geminiConfig,
data__diskEncryptionStatus,
data__switchTransactionLogsToCloudStorageEnabled,
data__kind,
data__suspensionReason,
data__replicaNames,
data__sqlNetworkArchitecture,
data__serverCaCert,
data__outOfDiskReport,
data__diskEncryptionConfiguration,
data__ipAddresses,
data__gceZone,
data__scheduledMaintenance,
data__failoverReplica,
data__onPremisesConfiguration,
data__backendType,
data__serviceAccountEmailAddress,
data__name,
data__secondaryGceZone,
project
)
SELECT
'{{ settings }}',
'{{ masterInstanceName }}',
'{{ replicaConfiguration }}',
'{{ region }}',
{{ satisfiesPzs }},
{{ includeReplicasForMajorVersionUpgrade }},
'{{ replicationCluster }}',
'{{ connectionName }}',
'{{ etag }}',
'{{ instanceType }}',
'{{ ipv6Address }}',
'{{ selfLink }}',
'{{ rootPassword }}',
'{{ databaseVersion }}',
'{{ maintenanceVersion }}',
{{ nodeCount }},
'{{ project }}',
'{{ maxDiskSize }}',
'{{ state }}',
'{{ currentDiskSize }}',
'{{ tags }}',
'{{ geminiConfig }}',
'{{ diskEncryptionStatus }}',
{{ switchTransactionLogsToCloudStorageEnabled }},
'{{ kind }}',
'{{ suspensionReason }}',
'{{ replicaNames }}',
'{{ sqlNetworkArchitecture }}',
'{{ serverCaCert }}',
'{{ outOfDiskReport }}',
'{{ diskEncryptionConfiguration }}',
'{{ ipAddresses }}',
'{{ gceZone }}',
'{{ scheduledMaintenance }}',
'{{ failoverReplica }}',
'{{ onPremisesConfiguration }}',
'{{ backendType }}',
'{{ serviceAccountEmailAddress }}',
'{{ name }}',
'{{ secondaryGceZone }}',
'{{ project }}'
RETURNING
name,
acquireSsrsLeaseContext,
apiWarning,
backupContext,
endTime,
error,
exportContext,
importContext,
insertTime,
kind,
operationType,
preCheckMajorVersionUpgradeContext,
selfLink,
startTime,
status,
subOperationType,
targetId,
targetLink,
targetProject,
user
;
# Description fields are for documentation purposes
- name: instances
props:
- name: project
value: string
description: Required parameter for the instances resource.
- name: settings
value: object
description: >
The user settings.
- name: masterInstanceName
value: string
description: >
The name of the instance which will act as primary in the replication setup.
- name: replicaConfiguration
value: object
description: >
Configuration specific to failover replicas and read replicas.
- name: region
value: string
description: >
The geographical region of the Cloud SQL instance. It can be one of the [regions](https://cloud.google.com/sql/docs/mysql/locations#location-r) where Cloud SQL operates: For example, `asia-east1`, `europe-west1`, and `us-central1`. The default value is `us-central1`.
- name: satisfiesPzs
value: boolean
description: >
This status indicates whether the instance satisfies PZS. The status is reserved for future use.
- name: includeReplicasForMajorVersionUpgrade
value: boolean
description: >
Input only. Determines whether an in-place major version upgrade of replicas happens when an in-place major version upgrade of a primary instance is initiated.
- name: replicationCluster
value: object
description: >
Optional. A primary instance and disaster recovery (DR) replica pair. A DR replica is a cross-region replica that you designate for failover in the event that the primary instance experiences regional failure. Applicable to MySQL and PostgreSQL.
- name: connectionName
value: string
description: >
Connection name of the Cloud SQL instance used in connection strings.
- name: etag
value: string
description: >
This field is deprecated and will be removed from a future version of the API. Use the `settings.settingsVersion` field instead.
- name: instanceType
value: string
description: >
The instance type.
valid_values: ['SQL_INSTANCE_TYPE_UNSPECIFIED', 'CLOUD_SQL_INSTANCE', 'ON_PREMISES_INSTANCE', 'READ_REPLICA_INSTANCE', 'READ_POOL_INSTANCE']
- name: ipv6Address
value: string
description: >
The IPv6 address assigned to the instance. (Deprecated) This property was applicable only to First Generation instances.
- name: selfLink
value: string
description: >
The URI of this resource.
- name: rootPassword
value: string
description: >
Initial root password. Use only on creation. You must set root passwords before you can connect to PostgreSQL instances.
- name: databaseVersion
value: string
description: >
The database engine type and version. The `databaseVersion` field cannot be changed after instance creation.
valid_values: ['SQL_DATABASE_VERSION_UNSPECIFIED', 'MYSQL_5_1', 'MYSQL_5_5', 'MYSQL_5_6', 'MYSQL_5_7', 'MYSQL_8_0', 'MYSQL_8_0_18', 'MYSQL_8_0_26', 'MYSQL_8_0_27', 'MYSQL_8_0_28', 'MYSQL_8_0_29', 'MYSQL_8_0_30', 'MYSQL_8_0_31', 'MYSQL_8_0_32', 'MYSQL_8_0_33', 'MYSQL_8_0_34', 'MYSQL_8_0_35', 'MYSQL_8_0_36', 'MYSQL_8_0_37', 'MYSQL_8_0_39', 'MYSQL_8_0_40', 'MYSQL_8_0_41', 'MYSQL_8_0_42', 'MYSQL_8_0_43', 'MYSQL_8_0_44', 'MYSQL_8_0_45', 'MYSQL_8_0_46', 'MYSQL_8_4', 'SQLSERVER_2017_STANDARD', 'SQLSERVER_2017_ENTERPRISE', 'SQLSERVER_2017_EXPRESS', 'SQLSERVER_2017_WEB', 'POSTGRES_9_6', 'POSTGRES_10', 'POSTGRES_11', 'POSTGRES_12', 'POSTGRES_13', 'POSTGRES_14', 'POSTGRES_15', 'POSTGRES_16', 'POSTGRES_17', 'POSTGRES_18', 'SQLSERVER_2019_STANDARD', 'SQLSERVER_2019_ENTERPRISE', 'SQLSERVER_2019_EXPRESS', 'SQLSERVER_2019_WEB', 'SQLSERVER_2022_STANDARD', 'SQLSERVER_2022_ENTERPRISE', 'SQLSERVER_2022_EXPRESS', 'SQLSERVER_2022_WEB']
- name: maintenanceVersion
value: string
description: >
The current software version on the instance.
- name: nodeCount
value: integer
description: >
The number of read pool nodes in a read pool.
- name: project
value: string
description: >
The project ID of the project containing the Cloud SQL instance. The Google apps domain is prefixed if applicable.
- name: maxDiskSize
value: string
description: >
The maximum disk size of the instance in bytes.
- name: state
value: string
description: >
The current serving state of the Cloud SQL instance.
valid_values: ['SQL_INSTANCE_STATE_UNSPECIFIED', 'RUNNABLE', 'SUSPENDED', 'PENDING_DELETE', 'PENDING_CREATE', 'MAINTENANCE', 'FAILED', 'ONLINE_MAINTENANCE', 'REPAIRING']
- name: currentDiskSize
value: string
description: >
The current disk usage of the instance in bytes. This property has been deprecated. Use the "cloudsql.googleapis.com/database/disk/bytes_used" metric in Cloud Monitoring API instead. Please see [this announcement](https://groups.google.com/d/msg/google-cloud-sql-announce/I_7-F9EBhT0/BtvFtdFeAgAJ) for details.
- name: tags
value: object
description: >
Optional. Input only. Immutable. Tag keys and tag values that are bound to this instance. You must represent each item in the map as: `"" : ""`. For example, a single resource can have the following tags: ``` "123/environment": "production", "123/costCenter": "marketing", ``` For more information on tag creation and management, see https://cloud.google.com/resource-manager/docs/tags/tags-overview.
- name: geminiConfig
value: object
description: >
Gemini instance configuration.
- name: diskEncryptionStatus
value: object
description: >
Disk encryption status specific to an instance.
- name: switchTransactionLogsToCloudStorageEnabled
value: boolean
description: >
Input only. Whether Cloud SQL is enabled to switch storing point-in-time recovery log files from a data disk to Cloud Storage.
- name: kind
value: string
description: >
This is always `sql#instance`.
- name: suspensionReason
value: array
description: >
If the instance state is SUSPENDED, the reason for the suspension.
- name: replicaNames
value: array
description: >
The replicas of the instance.
- name: sqlNetworkArchitecture
value: string
valid_values: ['SQL_NETWORK_ARCHITECTURE_UNSPECIFIED', 'NEW_NETWORK_ARCHITECTURE', 'OLD_NETWORK_ARCHITECTURE']
- name: serverCaCert
value: object
description: >
SSL configuration.
- name: outOfDiskReport
value: object
description: >
This field represents the report generated by the proactive database wellness job for OutOfDisk issues. * Writers: * the proactive database wellness job for OOD. * Readers: * the proactive database wellness job
- name: diskEncryptionConfiguration
value: object
description: >
Disk encryption configuration specific to an instance.
- name: ipAddresses
value: array
description: >
The assigned IP addresses for the instance.
- name: gceZone
value: string
description: >
The Compute Engine zone that the instance is currently serving from. This value could be different from the zone that was specified when the instance was created if the instance has failed over to its secondary zone. WARNING: Changing this might restart the instance.
- name: scheduledMaintenance
value: object
description: >
The start time of any upcoming scheduled maintenance for this instance.
- name: failoverReplica
value: object
description: >
The name and status of the failover replica.
- name: onPremisesConfiguration
value: object
description: >
Configuration specific to on-premises instances.
- name: backendType
value: string
description: >
The backend type. `SECOND_GEN`: Cloud SQL database instance. `EXTERNAL`: A database server that is not managed by Google. This property is read-only; use the `tier` property in the `settings` object to determine the database type.
valid_values: ['SQL_BACKEND_TYPE_UNSPECIFIED', 'FIRST_GEN', 'SECOND_GEN', 'EXTERNAL']
- name: serviceAccountEmailAddress
value: string
description: >
The service account email address assigned to the instance.\This property is read-only.
- name: name
value: string
description: >
Name of the Cloud SQL instance. This does not include the project ID.
- name: secondaryGceZone
value: string
description: >
The Compute Engine zone that the failover instance is currently serving from for a regional instance. This value could be different from the zone that was specified when the instance was created if the instance has failed over to its secondary/failover zone.
UPDATE examples
- patch
Partially updates settings of a Cloud SQL instance by merging the request with the current configuration. This method supports patch semantics.
UPDATE google.sqladmin.instances
SET
data__settings = '{{ settings }}',
data__masterInstanceName = '{{ masterInstanceName }}',
data__replicaConfiguration = '{{ replicaConfiguration }}',
data__region = '{{ region }}',
data__satisfiesPzs = {{ satisfiesPzs }},
data__includeReplicasForMajorVersionUpgrade = {{ includeReplicasForMajorVersionUpgrade }},
data__replicationCluster = '{{ replicationCluster }}',
data__connectionName = '{{ connectionName }}',
data__etag = '{{ etag }}',
data__instanceType = '{{ instanceType }}',
data__ipv6Address = '{{ ipv6Address }}',
data__selfLink = '{{ selfLink }}',
data__rootPassword = '{{ rootPassword }}',
data__databaseVersion = '{{ databaseVersion }}',
data__maintenanceVersion = '{{ maintenanceVersion }}',
data__nodeCount = {{ nodeCount }},
data__project = '{{ project }}',
data__maxDiskSize = '{{ maxDiskSize }}',
data__state = '{{ state }}',
data__currentDiskSize = '{{ currentDiskSize }}',
data__tags = '{{ tags }}',
data__geminiConfig = '{{ geminiConfig }}',
data__diskEncryptionStatus = '{{ diskEncryptionStatus }}',
data__switchTransactionLogsToCloudStorageEnabled = {{ switchTransactionLogsToCloudStorageEnabled }},
data__kind = '{{ kind }}',
data__suspensionReason = '{{ suspensionReason }}',
data__replicaNames = '{{ replicaNames }}',
data__sqlNetworkArchitecture = '{{ sqlNetworkArchitecture }}',
data__serverCaCert = '{{ serverCaCert }}',
data__outOfDiskReport = '{{ outOfDiskReport }}',
data__diskEncryptionConfiguration = '{{ diskEncryptionConfiguration }}',
data__ipAddresses = '{{ ipAddresses }}',
data__gceZone = '{{ gceZone }}',
data__scheduledMaintenance = '{{ scheduledMaintenance }}',
data__failoverReplica = '{{ failoverReplica }}',
data__onPremisesConfiguration = '{{ onPremisesConfiguration }}',
data__backendType = '{{ backendType }}',
data__serviceAccountEmailAddress = '{{ serviceAccountEmailAddress }}',
data__name = '{{ name }}',
data__secondaryGceZone = '{{ secondaryGceZone }}'
WHERE
project = '{{ project }}' --required
AND instance = '{{ instance }}' --required
RETURNING
name,
acquireSsrsLeaseContext,
apiWarning,
backupContext,
endTime,
error,
exportContext,
importContext,
insertTime,
kind,
operationType,
preCheckMajorVersionUpgradeContext,
selfLink,
startTime,
status,
subOperationType,
targetId,
targetLink,
targetProject,
user;
REPLACE examples
- update
Updates settings of a Cloud SQL instance. Using this operation might cause your instance to restart.
REPLACE google.sqladmin.instances
SET
data__settings = '{{ settings }}',
data__masterInstanceName = '{{ masterInstanceName }}',
data__replicaConfiguration = '{{ replicaConfiguration }}',
data__region = '{{ region }}',
data__satisfiesPzs = {{ satisfiesPzs }},
data__includeReplicasForMajorVersionUpgrade = {{ includeReplicasForMajorVersionUpgrade }},
data__replicationCluster = '{{ replicationCluster }}',
data__connectionName = '{{ connectionName }}',
data__etag = '{{ etag }}',
data__instanceType = '{{ instanceType }}',
data__ipv6Address = '{{ ipv6Address }}',
data__selfLink = '{{ selfLink }}',
data__rootPassword = '{{ rootPassword }}',
data__databaseVersion = '{{ databaseVersion }}',
data__maintenanceVersion = '{{ maintenanceVersion }}',
data__nodeCount = {{ nodeCount }},
data__project = '{{ project }}',
data__maxDiskSize = '{{ maxDiskSize }}',
data__state = '{{ state }}',
data__currentDiskSize = '{{ currentDiskSize }}',
data__tags = '{{ tags }}',
data__geminiConfig = '{{ geminiConfig }}',
data__diskEncryptionStatus = '{{ diskEncryptionStatus }}',
data__switchTransactionLogsToCloudStorageEnabled = {{ switchTransactionLogsToCloudStorageEnabled }},
data__kind = '{{ kind }}',
data__suspensionReason = '{{ suspensionReason }}',
data__replicaNames = '{{ replicaNames }}',
data__sqlNetworkArchitecture = '{{ sqlNetworkArchitecture }}',
data__serverCaCert = '{{ serverCaCert }}',
data__outOfDiskReport = '{{ outOfDiskReport }}',
data__diskEncryptionConfiguration = '{{ diskEncryptionConfiguration }}',
data__ipAddresses = '{{ ipAddresses }}',
data__gceZone = '{{ gceZone }}',
data__scheduledMaintenance = '{{ scheduledMaintenance }}',
data__failoverReplica = '{{ failoverReplica }}',
data__onPremisesConfiguration = '{{ onPremisesConfiguration }}',
data__backendType = '{{ backendType }}',
data__serviceAccountEmailAddress = '{{ serviceAccountEmailAddress }}',
data__name = '{{ name }}',
data__secondaryGceZone = '{{ secondaryGceZone }}'
WHERE
project = '{{ project }}' --required
AND instance = '{{ instance }}' --required
RETURNING
name,
acquireSsrsLeaseContext,
apiWarning,
backupContext,
endTime,
error,
exportContext,
importContext,
insertTime,
kind,
operationType,
preCheckMajorVersionUpgradeContext,
selfLink,
startTime,
status,
subOperationType,
targetId,
targetLink,
targetProject,
user;
DELETE examples
- delete
Deletes a Cloud SQL instance.
DELETE FROM google.sqladmin.instances
WHERE project = '{{ project }}' --required
AND instance = '{{ instance }}' --required
AND enableFinalBackup = '{{ enableFinalBackup }}'
AND finalBackupDescription = '{{ finalBackupDescription }}'
AND finalBackupTtlDays = '{{ finalBackupTtlDays }}'
AND finalBackupExpiryTime = '{{ finalBackupExpiryTime }}'
;
Lifecycle Methods
- pre_check_major_version_upgrade
- execute_sql
- list_entra_id_certificates
- rotate_server_ca
- reencrypt
- clone
- export
- list_server_certificates
- point_in_time_restore
- acquire_ssrs_lease
- failover
- reset_ssl_config
- promote_replica
- restart
- stop_replica
- demote_master
- switchover
- truncate_log
- demote
- restore_backup
- start_replica
- rotate_server_certificate
- rotate_entra_id_certificate
- release_ssrs_lease
- import
- start_external_sync
- reset_replica_size
- reschedule_maintenance
- verify_external_sync_settings
- perform_disk_shrink
Execute MVU Pre-checks
EXEC google.sqladmin.instances.pre_check_major_version_upgrade
@project='{{ project }}' --required,
@instance='{{ instance }}' --required
@@json=
'{
"preCheckMajorVersionUpgradeContext": "{{ preCheckMajorVersionUpgradeContext }}"
}'
;
Execute SQL statements.
EXEC google.sqladmin.instances.execute_sql
@project='{{ project }}' --required,
@instance='{{ instance }}' --required
@@json=
'{
"partialResultMode": "{{ partialResultMode }}",
"rowLimit": "{{ rowLimit }}",
"user": "{{ user }}",
"database": "{{ database }}",
"sqlStatement": "{{ sqlStatement }}",
"autoIamAuthn": {{ autoIamAuthn }}
}'
;
Lists all versions of EntraID certificates for the specified instance. There can be up to three sets of certificates listed: the certificate that is currently in use, a future that has been added but not yet used to sign a certificate, and a certificate that has been rotated out.
EXEC google.sqladmin.instances.list_entra_id_certificates
@project='{{ project }}' --required,
@instance='{{ instance }}' --required
;
Rotates the server certificate to one signed by the Certificate Authority (CA) version previously added with the addServerCA method. For instances that have enabled Certificate Authority Service (CAS) based server CA, use RotateServerCertificate to rotate the server certificate.
EXEC google.sqladmin.instances.rotate_server_ca
@project='{{ project }}' --required,
@instance='{{ instance }}' --required
@@json=
'{
"rotateServerCaContext": "{{ rotateServerCaContext }}"
}'
;
Reencrypt CMEK instance with latest key version.
EXEC google.sqladmin.instances.reencrypt
@project='{{ project }}' --required,
@instance='{{ instance }}' --required
@@json=
'{
"backupReencryptionConfig": "{{ backupReencryptionConfig }}"
}'
;
Creates a Cloud SQL instance as a clone of the source instance. Using this operation might cause your instance to restart.
EXEC google.sqladmin.instances.clone
@project='{{ project }}' --required,
@instance='{{ instance }}' --required
@@json=
'{
"cloneContext": "{{ cloneContext }}"
}'
;
Exports data from a Cloud SQL instance to a Cloud Storage bucket as a SQL dump or CSV file.
EXEC google.sqladmin.instances.export
@project='{{ project }}' --required,
@instance='{{ instance }}' --required
@@json=
'{
"exportContext": "{{ exportContext }}"
}'
;
Lists all versions of server certificates and certificate authorities (CAs) for the specified instance. There can be up to three sets of certs listed: the certificate that is currently in use, a future that has been added but not yet used to sign a certificate, and a certificate that has been rotated out. For instances not using Certificate Authority Service (CAS) server CA, use ListServerCas instead.
EXEC google.sqladmin.instances.list_server_certificates
@project='{{ project }}' --required,
@instance='{{ instance }}' --required
;
Point in time restore for an instance managed by Google Cloud Backup and Disaster Recovery.
EXEC google.sqladmin.instances.point_in_time_restore
@projectsId='{{ projectsId }}' --required
@@json=
'{
"targetInstance": "{{ targetInstance }}",
"preferredSecondaryZone": "{{ preferredSecondaryZone }}",
"privateNetwork": "{{ privateNetwork }}",
"pointInTime": "{{ pointInTime }}",
"datasource": "{{ datasource }}",
"preferredZone": "{{ preferredZone }}",
"allocatedIpRange": "{{ allocatedIpRange }}"
}'
;
Acquire a lease for the setup of SQL Server Reporting Services (SSRS).
EXEC google.sqladmin.instances.acquire_ssrs_lease
@project='{{ project }}' --required,
@instance='{{ instance }}' --required
@@json=
'{
"acquireSsrsLeaseContext": "{{ acquireSsrsLeaseContext }}"
}'
;
Initiates a manual failover of a high availability (HA) primary instance to a standby instance, which becomes the primary instance. Users are then rerouted to the new primary. For more information, see the Overview of high availability page in the Cloud SQL documentation. If using Legacy HA (MySQL only), this causes the instance to failover to its failover replica instance.
EXEC google.sqladmin.instances.failover
@project='{{ project }}' --required,
@instance='{{ instance }}' --required
@@json=
'{
"failoverContext": "{{ failoverContext }}"
}'
;
Deletes all client certificates and generates a new server SSL certificate for the instance.
EXEC google.sqladmin.instances.reset_ssl_config
@project='{{ project }}' --required,
@instance='{{ instance }}' --required,
@mode='{{ mode }}'
;
Promotes the read replica instance to be an independent Cloud SQL primary instance. Using this operation might cause your instance to restart.
EXEC google.sqladmin.instances.promote_replica
@project='{{ project }}' --required,
@instance='{{ instance }}' --required,
@failover={{ failover }}
;
Restarts a Cloud SQL instance.
EXEC google.sqladmin.instances.restart
@project='{{ project }}' --required,
@instance='{{ instance }}' --required
;
Stops the replication in the read replica instance.
EXEC google.sqladmin.instances.stop_replica
@project='{{ project }}' --required,
@instance='{{ instance }}' --required
;
Demotes the stand-alone instance to be a Cloud SQL read replica for an external database server.
EXEC google.sqladmin.instances.demote_master
@project='{{ project }}' --required,
@instance='{{ instance }}' --required
@@json=
'{
"demoteMasterContext": "{{ demoteMasterContext }}"
}'
;
Switches over from the primary instance to the DR replica instance.
EXEC google.sqladmin.instances.switchover
@project='{{ project }}' --required,
@instance='{{ instance }}' --required,
@dbTimeout='{{ dbTimeout }}'
;
Truncate MySQL general and slow query log tables MySQL only.
EXEC google.sqladmin.instances.truncate_log
@project='{{ project }}' --required,
@instance='{{ instance }}' --required
@@json=
'{
"truncateLogContext": "{{ truncateLogContext }}"
}'
;
Demotes an existing standalone instance to be a Cloud SQL read replica for an external database server.
EXEC google.sqladmin.instances.demote
@project='{{ project }}' --required,
@instance='{{ instance }}' --required
@@json=
'{
"demoteContext": "{{ demoteContext }}"
}'
;
Restores a backup of a Cloud SQL instance. Using this operation might cause your instance to restart.
EXEC google.sqladmin.instances.restore_backup
@project='{{ project }}' --required,
@instance='{{ instance }}' --required
@@json=
'{
"restoreInstanceClearOverridesFieldNames": "{{ restoreInstanceClearOverridesFieldNames }}",
"backup": "{{ backup }}",
"backupdrBackup": "{{ backupdrBackup }}",
"restoreBackupContext": "{{ restoreBackupContext }}",
"restoreInstanceSettings": "{{ restoreInstanceSettings }}"
}'
;
Starts the replication in the read replica instance.
EXEC google.sqladmin.instances.start_replica
@project='{{ project }}' --required,
@instance='{{ instance }}' --required
;
Rotates the server certificate version to one previously added with the addServerCertificate method. For instances not using Certificate Authority Service (CAS) server CA, use RotateServerCa instead.
EXEC google.sqladmin.instances.rotate_server_certificate
@project='{{ project }}' --required,
@instance='{{ instance }}' --required
@@json=
'{
"rotateServerCertificateContext": "{{ rotateServerCertificateContext }}"
}'
;
Rotates the server certificate version to one previously added with the addEntraIdCertificate method.
EXEC google.sqladmin.instances.rotate_entra_id_certificate
@project='{{ project }}' --required,
@instance='{{ instance }}' --required
@@json=
'{
"rotateEntraIdCertificateContext": "{{ rotateEntraIdCertificateContext }}"
}'
;
Release a lease for the setup of SQL Server Reporting Services (SSRS).
EXEC google.sqladmin.instances.release_ssrs_lease
@project='{{ project }}' --required,
@instance='{{ instance }}' --required
;
Imports data into a Cloud SQL instance from a SQL dump or CSV file in Cloud Storage.
EXEC google.sqladmin.instances.import
@project='{{ project }}' --required,
@instance='{{ instance }}' --required
@@json=
'{
"importContext": "{{ importContext }}"
}'
;
Start External primary instance migration.
EXEC google.sqladmin.instances.start_external_sync
@project='{{ project }}' --required,
@instance='{{ instance }}' --required
@@json=
'{
"skipVerification": {{ skipVerification }},
"migrationType": "{{ migrationType }}",
"replicaOverwriteEnabled": {{ replicaOverwriteEnabled }},
"syncMode": "{{ syncMode }}",
"syncParallelLevel": "{{ syncParallelLevel }}",
"mysqlSyncConfig": "{{ mysqlSyncConfig }}"
}'
;
Reset Replica Size to primary instance disk size.
EXEC google.sqladmin.instances.reset_replica_size
@project='{{ project }}' --required,
@instance='{{ instance }}' --required
;
Reschedules the maintenance on the given instance.
EXEC google.sqladmin.instances.reschedule_maintenance
@project='{{ project }}' --required,
@instance='{{ instance }}' --required
@@json=
'{
"reschedule": "{{ reschedule }}"
}'
;
Verify External primary instance external sync settings.
EXEC google.sqladmin.instances.verify_external_sync_settings
@project='{{ project }}' --required,
@instance='{{ instance }}' --required
@@json=
'{
"verifyConnectionOnly": {{ verifyConnectionOnly }},
"mysqlSyncConfig": "{{ mysqlSyncConfig }}",
"selectedObjects": "{{ selectedObjects }}",
"syncParallelLevel": "{{ syncParallelLevel }}",
"syncMode": "{{ syncMode }}",
"migrationType": "{{ migrationType }}",
"verifyReplicationOnly": {{ verifyReplicationOnly }}
}'
;
Perform Disk Shrink on primary instance.
EXEC google.sqladmin.instances.perform_disk_shrink
@project='{{ project }}' --required,
@instance='{{ instance }}' --required
@@json=
'{
"targetSizeGb": "{{ targetSizeGb }}"
}'
;