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
Successful response
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. |
Successful response
Name | Datatype | Description |
---|---|---|
code | string | Code to uniquely identify the warning type. |
message | string | The warning message. |
region | string | The region name for REGION_UNREACHABLE warning. |
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 , finalBackupTtlDays , finalBackupExpiryTime , finalBackupDescription | Deletes a Cloud SQL instance. |
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. | |
demote_master | exec | project , instance | Demotes the stand-alone instance to be a Cloud SQL read replica for an external database server. | |
demote | exec | project , instance | Demotes an existing standalone instance to be a Cloud SQL read replica for an external database server. | |
export | exec | project , instance | Exports data from a Cloud SQL instance to a Cloud Storage bucket as a SQL dump or CSV file. | |
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. | |
reencrypt | exec | project , instance | Reencrypt CMEK instance with latest key version. | |
import | exec | project , instance | Imports data into a Cloud SQL instance from a SQL dump or CSV file in Cloud Storage. | |
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. | |
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. |
switchover | exec | project , instance | dbTimeout | Switches over from the primary instance to the DR replica instance. |
reset_ssl_config | exec | project , instance | Deletes all client certificates and generates a new server SSL certificate for the instance. | |
restart | exec | project , instance | Restarts a Cloud SQL instance. | |
restore_backup | exec | project , instance | Restores a backup of a Cloud SQL instance. Using this operation might cause your instance to restart. | |
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. | |
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. | |
start_replica | exec | project , instance | Starts the replication in the read replica instance. | |
stop_replica | exec | project , instance | Stops the replication in the read replica instance. | |
truncate_log | exec | project , instance | Truncate MySQL general and slow query log tables MySQL only. | |
execute_sql | exec | project , instance | Execute SQL statements. | |
acquire_ssrs_lease | exec | project , instance | Acquire a lease for the setup of SQL Server Reporting Services (SSRS). | |
release_ssrs_lease | exec | project , instance | Release a lease for the setup of SQL Server Reporting Services (SSRS). | |
point_in_time_restore | exec | projectsId | Point in time restore for an instance managed by Google Cloud Backup and Disaster Recovery. | |
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. | |
start_external_sync | exec | project , instance | Start External primary instance migration. | |
perform_disk_shrink | exec | project , instance | Perform Disk Shrink on primary instance. | |
reset_replica_size | exec | project , instance | Reset Replica Size to primary instance disk size. |
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) | |
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
code,
message,
region
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__kind,
data__state,
data__databaseVersion,
data__settings,
data__etag,
data__failoverReplica,
data__masterInstanceName,
data__replicaNames,
data__maxDiskSize,
data__currentDiskSize,
data__ipAddresses,
data__serverCaCert,
data__instanceType,
data__project,
data__ipv6Address,
data__serviceAccountEmailAddress,
data__onPremisesConfiguration,
data__replicaConfiguration,
data__backendType,
data__selfLink,
data__suspensionReason,
data__connectionName,
data__name,
data__region,
data__gceZone,
data__secondaryGceZone,
data__diskEncryptionConfiguration,
data__diskEncryptionStatus,
data__rootPassword,
data__scheduledMaintenance,
data__satisfiesPzs,
data__outOfDiskReport,
data__maintenanceVersion,
data__sqlNetworkArchitecture,
data__replicationCluster,
data__geminiConfig,
data__switchTransactionLogsToCloudStorageEnabled,
data__includeReplicasForMajorVersionUpgrade,
data__tags,
data__nodeCount,
project
)
SELECT
'{{ kind }}',
'{{ state }}',
'{{ databaseVersion }}',
'{{ settings }}',
'{{ etag }}',
'{{ failoverReplica }}',
'{{ masterInstanceName }}',
'{{ replicaNames }}',
'{{ maxDiskSize }}',
'{{ currentDiskSize }}',
'{{ ipAddresses }}',
'{{ serverCaCert }}',
'{{ instanceType }}',
'{{ project }}',
'{{ ipv6Address }}',
'{{ serviceAccountEmailAddress }}',
'{{ onPremisesConfiguration }}',
'{{ replicaConfiguration }}',
'{{ backendType }}',
'{{ selfLink }}',
'{{ suspensionReason }}',
'{{ connectionName }}',
'{{ name }}',
'{{ region }}',
'{{ gceZone }}',
'{{ secondaryGceZone }}',
'{{ diskEncryptionConfiguration }}',
'{{ diskEncryptionStatus }}',
'{{ rootPassword }}',
'{{ scheduledMaintenance }}',
{{ satisfiesPzs }},
'{{ outOfDiskReport }}',
'{{ maintenanceVersion }}',
'{{ sqlNetworkArchitecture }}',
'{{ replicationCluster }}',
'{{ geminiConfig }}',
{{ switchTransactionLogsToCloudStorageEnabled }},
{{ includeReplicasForMajorVersionUpgrade }},
'{{ tags }}',
{{ nodeCount }},
'{{ project }}'
RETURNING
name,
acquireSsrsLeaseContext,
apiWarning,
backupContext,
endTime,
error,
exportContext,
importContext,
insertTime,
kind,
operationType,
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: kind
value: string
description: >
This is always `sql#instance`.
- 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: 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', '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: settings
value: object
description: >
The user settings.
- 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: failoverReplica
value: object
description: >
The name and status of the failover replica.
- name: masterInstanceName
value: string
description: >
The name of the instance which will act as primary in the replication setup.
- name: replicaNames
value: array
description: >
The replicas of the instance.
- name: maxDiskSize
value: string
description: >
The maximum disk size of the instance in bytes.
- 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: ipAddresses
value: array
description: >
The assigned IP addresses for the instance.
- name: serverCaCert
value: object
description: >
SSL configuration.
- 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: project
value: string
description: >
The project ID of the project containing the Cloud SQL instance. The Google apps domain is prefixed if applicable.
- name: ipv6Address
value: string
description: >
The IPv6 address assigned to the instance. (Deprecated) This property was applicable only to First Generation instances.
- name: serviceAccountEmailAddress
value: string
description: >
The service account email address assigned to the instance.\This property is read-only.
- name: onPremisesConfiguration
value: object
description: >
Configuration specific to on-premises instances.
- name: replicaConfiguration
value: object
description: >
Configuration specific to failover replicas and read replicas.
- 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: selfLink
value: string
description: >
The URI of this resource.
- name: suspensionReason
value: array
description: >
If the instance state is SUSPENDED, the reason for the suspension.
- name: connectionName
value: string
description: >
Connection name of the Cloud SQL instance used in connection strings.
- name: name
value: string
description: >
Name of the Cloud SQL instance. This does not include the project ID.
- 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: 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: 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.
- name: diskEncryptionConfiguration
value: object
description: >
Disk encryption configuration specific to an instance.
- name: diskEncryptionStatus
value: object
description: >
Disk encryption status specific to an instance.
- 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: scheduledMaintenance
value: object
description: >
The start time of any upcoming scheduled maintenance for this instance.
- name: satisfiesPzs
value: boolean
description: >
This status indicates whether the instance satisfies PZS. The status is reserved for future use.
- 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: maintenanceVersion
value: string
description: >
The current software version on the instance.
- name: sqlNetworkArchitecture
value: string
valid_values: ['SQL_NETWORK_ARCHITECTURE_UNSPECIFIED', 'NEW_NETWORK_ARCHITECTURE', 'OLD_NETWORK_ARCHITECTURE']
- 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: geminiConfig
value: object
description: >
Gemini instance configuration.
- 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: 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: 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: nodeCount
value: integer
description: >
The number of read pool nodes in a read pool.
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__kind = '{{ kind }}',
data__state = '{{ state }}',
data__databaseVersion = '{{ databaseVersion }}',
data__settings = '{{ settings }}',
data__etag = '{{ etag }}',
data__failoverReplica = '{{ failoverReplica }}',
data__masterInstanceName = '{{ masterInstanceName }}',
data__replicaNames = '{{ replicaNames }}',
data__maxDiskSize = '{{ maxDiskSize }}',
data__currentDiskSize = '{{ currentDiskSize }}',
data__ipAddresses = '{{ ipAddresses }}',
data__serverCaCert = '{{ serverCaCert }}',
data__instanceType = '{{ instanceType }}',
data__project = '{{ project }}',
data__ipv6Address = '{{ ipv6Address }}',
data__serviceAccountEmailAddress = '{{ serviceAccountEmailAddress }}',
data__onPremisesConfiguration = '{{ onPremisesConfiguration }}',
data__replicaConfiguration = '{{ replicaConfiguration }}',
data__backendType = '{{ backendType }}',
data__selfLink = '{{ selfLink }}',
data__suspensionReason = '{{ suspensionReason }}',
data__connectionName = '{{ connectionName }}',
data__name = '{{ name }}',
data__region = '{{ region }}',
data__gceZone = '{{ gceZone }}',
data__secondaryGceZone = '{{ secondaryGceZone }}',
data__diskEncryptionConfiguration = '{{ diskEncryptionConfiguration }}',
data__diskEncryptionStatus = '{{ diskEncryptionStatus }}',
data__rootPassword = '{{ rootPassword }}',
data__scheduledMaintenance = '{{ scheduledMaintenance }}',
data__satisfiesPzs = {{ satisfiesPzs }},
data__outOfDiskReport = '{{ outOfDiskReport }}',
data__maintenanceVersion = '{{ maintenanceVersion }}',
data__sqlNetworkArchitecture = '{{ sqlNetworkArchitecture }}',
data__replicationCluster = '{{ replicationCluster }}',
data__geminiConfig = '{{ geminiConfig }}',
data__switchTransactionLogsToCloudStorageEnabled = {{ switchTransactionLogsToCloudStorageEnabled }},
data__includeReplicasForMajorVersionUpgrade = {{ includeReplicasForMajorVersionUpgrade }},
data__tags = '{{ tags }}',
data__nodeCount = {{ nodeCount }}
WHERE
project = '{{ project }}' --required
AND instance = '{{ instance }}' --required
RETURNING
name,
acquireSsrsLeaseContext,
apiWarning,
backupContext,
endTime,
error,
exportContext,
importContext,
insertTime,
kind,
operationType,
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__kind = '{{ kind }}',
data__state = '{{ state }}',
data__databaseVersion = '{{ databaseVersion }}',
data__settings = '{{ settings }}',
data__etag = '{{ etag }}',
data__failoverReplica = '{{ failoverReplica }}',
data__masterInstanceName = '{{ masterInstanceName }}',
data__replicaNames = '{{ replicaNames }}',
data__maxDiskSize = '{{ maxDiskSize }}',
data__currentDiskSize = '{{ currentDiskSize }}',
data__ipAddresses = '{{ ipAddresses }}',
data__serverCaCert = '{{ serverCaCert }}',
data__instanceType = '{{ instanceType }}',
data__project = '{{ project }}',
data__ipv6Address = '{{ ipv6Address }}',
data__serviceAccountEmailAddress = '{{ serviceAccountEmailAddress }}',
data__onPremisesConfiguration = '{{ onPremisesConfiguration }}',
data__replicaConfiguration = '{{ replicaConfiguration }}',
data__backendType = '{{ backendType }}',
data__selfLink = '{{ selfLink }}',
data__suspensionReason = '{{ suspensionReason }}',
data__connectionName = '{{ connectionName }}',
data__name = '{{ name }}',
data__region = '{{ region }}',
data__gceZone = '{{ gceZone }}',
data__secondaryGceZone = '{{ secondaryGceZone }}',
data__diskEncryptionConfiguration = '{{ diskEncryptionConfiguration }}',
data__diskEncryptionStatus = '{{ diskEncryptionStatus }}',
data__rootPassword = '{{ rootPassword }}',
data__scheduledMaintenance = '{{ scheduledMaintenance }}',
data__satisfiesPzs = {{ satisfiesPzs }},
data__outOfDiskReport = '{{ outOfDiskReport }}',
data__maintenanceVersion = '{{ maintenanceVersion }}',
data__sqlNetworkArchitecture = '{{ sqlNetworkArchitecture }}',
data__replicationCluster = '{{ replicationCluster }}',
data__geminiConfig = '{{ geminiConfig }}',
data__switchTransactionLogsToCloudStorageEnabled = {{ switchTransactionLogsToCloudStorageEnabled }},
data__includeReplicasForMajorVersionUpgrade = {{ includeReplicasForMajorVersionUpgrade }},
data__tags = '{{ tags }}',
data__nodeCount = {{ nodeCount }}
WHERE
project = '{{ project }}' --required
AND instance = '{{ instance }}' --required
RETURNING
name,
acquireSsrsLeaseContext,
apiWarning,
backupContext,
endTime,
error,
exportContext,
importContext,
insertTime,
kind,
operationType,
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 finalBackupTtlDays = '{{ finalBackupTtlDays }}'
AND finalBackupExpiryTime = '{{ finalBackupExpiryTime }}'
AND finalBackupDescription = '{{ finalBackupDescription }}';
Lifecycle Methods
- clone
- demote_master
- demote
- export
- failover
- reencrypt
- import
- list_server_certificates
- promote_replica
- switchover
- reset_ssl_config
- restart
- restore_backup
- rotate_server_ca
- rotate_server_certificate
- start_replica
- stop_replica
- truncate_log
- execute_sql
- acquire_ssrs_lease
- release_ssrs_lease
- point_in_time_restore
- reschedule_maintenance
- verify_external_sync_settings
- start_external_sync
- perform_disk_shrink
- reset_replica_size
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 }}"
}';
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 }}"
}';
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 }}"
}';
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 }}"
}';
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 }}"
}';
Reencrypt CMEK instance with latest key version.
EXEC google.sqladmin.instances.reencrypt
@project='{{ project }}' --required,
@instance='{{ instance }}' --required
@@json=
'{
"backupReencryptionConfig": "{{ backupReencryptionConfig }}"
}';
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 }}"
}';
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;
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 }};
Switches over from the primary instance to the DR replica instance.
EXEC google.sqladmin.instances.switchover
@project='{{ project }}' --required,
@instance='{{ instance }}' --required,
@dbTimeout='{{ dbTimeout }}';
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;
Restarts a Cloud SQL instance.
EXEC google.sqladmin.instances.restart
@project='{{ project }}' --required,
@instance='{{ instance }}' --required;
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=
'{
"restoreBackupContext": "{{ restoreBackupContext }}",
"backup": "{{ backup }}",
"backupdrBackup": "{{ backupdrBackup }}",
"restoreInstanceSettings": "{{ restoreInstanceSettings }}",
"restoreInstanceClearOverridesFieldNames": "{{ restoreInstanceClearOverridesFieldNames }}"
}';
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 }}"
}';
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 }}"
}';
Starts the replication in the read replica instance.
EXEC google.sqladmin.instances.start_replica
@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;
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 }}"
}';
Execute SQL statements.
EXEC google.sqladmin.instances.execute_sql
@project='{{ project }}' --required,
@instance='{{ instance }}' --required
@@json=
'{
"sqlStatement": "{{ sqlStatement }}",
"database": "{{ database }}",
"autoIamAuthn": {{ autoIamAuthn }},
"rowLimit": "{{ rowLimit }}"
}';
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 }}"
}';
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;
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=
'{
"datasource": "{{ datasource }}",
"pointInTime": "{{ pointInTime }}",
"targetInstance": "{{ targetInstance }}",
"privateNetwork": "{{ privateNetwork }}",
"allocatedIpRange": "{{ allocatedIpRange }}",
"preferredZone": "{{ preferredZone }}",
"preferredSecondaryZone": "{{ preferredSecondaryZone }}"
}';
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 }},
"syncMode": "{{ syncMode }}",
"verifyReplicationOnly": {{ verifyReplicationOnly }},
"mysqlSyncConfig": "{{ mysqlSyncConfig }}",
"migrationType": "{{ migrationType }}",
"syncParallelLevel": "{{ syncParallelLevel }}",
"selectedObjects": "{{ selectedObjects }}"
}';
Start External primary instance migration.
EXEC google.sqladmin.instances.start_external_sync
@project='{{ project }}' --required,
@instance='{{ instance }}' --required
@@json=
'{
"syncMode": "{{ syncMode }}",
"skipVerification": {{ skipVerification }},
"mysqlSyncConfig": "{{ mysqlSyncConfig }}",
"syncParallelLevel": "{{ syncParallelLevel }}",
"migrationType": "{{ migrationType }}",
"replicaOverwriteEnabled": {{ replicaOverwriteEnabled }}
}';
Perform Disk Shrink on primary instance.
EXEC google.sqladmin.instances.perform_disk_shrink
@project='{{ project }}' --required,
@instance='{{ instance }}' --required
@@json=
'{
"targetSizeGb": "{{ targetSizeGb }}"
}';
Reset Replica Size to primary instance disk size.
EXEC google.sqladmin.instances.reset_replica_size
@project='{{ project }}' --required,
@instance='{{ instance }}' --required;