Represents a Cloud SQL instance. Cloud SQL instances are SQL databases hosted in Google's cloud. The Instances resource provides methods for common configuration and management tasks. For more information, see Creating Instances and Instance Settings.

For a list of methods for this resource, see the end of this page.

Resource representations

A Cloud SQL instance resource.

  "kind": "sql#instance",
  "selfLink": string,
  "name": string,
  "connectionName": string,
  "etag": string,
  "project": string,
  "state": string,
  "backendType": string,
  "databaseVersion": string,
  "region": string,
  "currentDiskSize": long,
  "maxDiskSize": long,
  "settings": {
    "kind": "sql#settings",
    "settingsVersion": long,
    "authorizedGaeApplications": [
    "tier": string,
    "backupConfiguration": {
      "kind": "sql#backupConfiguration",
      "startTime": string,
      "location": string,
      "enabled": boolean,
      "binaryLogEnabled": boolean,
      "replicationLogArchivingEnabled": boolean
    "pricingPlan": string,
    "replicationType": string,
    "activationPolicy": string,
    "ipConfiguration": {
      "ipv4Enabled": boolean,
      "authorizedNetworks": [
          "kind": "sql#aclEntry",
          "value": string,
          "name": string,
          "expirationTime": datetime
      "requireSsl": boolean,
      "privateNetwork": string
    "locationPreference": {
      "kind": "sql#locationPreference",
      "followGaeApplication": string,
      "zone": string
    "databaseFlags": [
        "name": string,
        "value": string
    "databaseReplicationEnabled": boolean,
    "crashSafeReplicationEnabled": boolean,
    "dataDiskSizeGb": long,
    "dataDiskType": string,
    "maintenanceWindow": {
      "kind": "sql#maintenanceWindow",
      "hour": integer,
      "day": integer,
      "updateTrack": string
    "storageAutoResize": boolean,
    "storageAutoResizeLimit": long,
    "availabilityType": string,
    "userLabels": {
      (key): string
  "serverCaCert": sslCerts Resource,
  "ipAddresses": [
      "ipAddress": string,
      "timeToRetire": datetime,
      "type": string
  "instanceType": string,
  "masterInstanceName": string,
  "replicaNames": [
  "failoverReplica": {
    "name": string,
    "available": boolean
  "ipv6Address": string,
  "serviceAccountEmailAddress": string,
  "onPremisesConfiguration": {
    "kind": "sql#onPremisesConfiguration",
    "hostPort": string
  "replicaConfiguration": {
    "kind": "sql#replicaConfiguration",
    "mysqlReplicaConfiguration": {
      "kind": "sql#mysqlReplicaConfiguration",
      "dumpFilePath": string,
      "username": string,
      "password": string,
      "connectRetryInterval": integer,
      "masterHeartbeatPeriod": long,
      "caCertificate": string,
      "clientCertificate": string,
      "clientKey": string,
      "sslCipher": string,
      "verifyServerCertificate": boolean
    "failoverTarget": boolean
  "suspensionReason": [
  "gceZone": string
Property name Value Description Notes
backendType string FIRST_GEN: First Generation instance. MySQL only.
SECOND_GEN: Second Generation instance or PostgreSQL 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 and Second or First Generation.
connectionName string Connection name of the Cloud SQL instance used in connection strings.
currentDiskSize long The current disk usage of the instance in bytes. This property has been deprecated. Users should use the "" metric in Cloud Monitoring API instead. Please see this announcement for details.
databaseVersion string The database engine type and version. The databaseVersion field can not be changed after instance creation.

MySQL Second Generation instances: MYSQL_5_7 (default) or MYSQL_5_6.

PostgreSQL instances: POSTGRES_11 (default) or POSTGRES_9_6

MySQL First Generation instances: MYSQL_5_6 (default)

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. This property is applicable only to Second Generation instances. writable
failoverReplica.available boolean The availability status of the failover replica. A false status indicates that the failover replica is out of sync. The master can only failover to the failover replica when the status is true. string The name of the failover replica. If specified at instance creation, a failover replica is created for the instance. The name doesn't include the project ID. This property is applicable only to Second Generation instances. writable
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.
instanceType string The instance type. This can be one of the following.
CLOUD_SQL_INSTANCE: A Cloud SQL instance that is not replicating from a master.
ON_PREMISES_INSTANCE: An instance running on the customer's premises.
READ_REPLICA_INSTANCE: A Cloud SQL instance configured as a read-replica.
ipAddresses[] list The assigned IP addresses for the instance.
ipAddresses[].ipAddress string The IP address assigned.
ipAddresses[].timeToRetire datetime The due time for this IP to be retired in RFC 3339 format, for example 2012-11-15T16:19:00.094Z. This field is only available when the IP is scheduled to be retired.
ipAddresses[].type string The type of this IP address. A PRIMARY address is an address that can accept incoming connections. An OUTGOING address is the source address of connections originating from the instance, if supported.
ipv6Address string The IPv6 address assigned to the instance. This property is applicable only to First Generation instances.
kind string This is always sql#instance.
masterInstanceName string The name of the instance which will act as master in the replication setup. writable
maxDiskSize long The maximum disk size of the instance in bytes.
name string Name of the Cloud SQL instance. This does not include the project ID.
onPremisesConfiguration nested object Configuration specific to on-premises instances. writable
onPremisesConfiguration.hostPort string The host and port of the on-premises instance in host:port format
onPremisesConfiguration.kind string This is always sql#onPremisesConfiguration.
project string The project ID of the project containing the Cloud SQL instance. The Google apps domain is prefixed if applicable.
region string The geographical region. Defaults to us-central or us-central1 depending on the instance type (First Generation or Second Generation/PostgreSQL). For a complete list of valid values, see Instance Locations. The region cannot be changed after instance creation. writable
replicaConfiguration nested object Configuration specific to failover replicas and read replicas. writable
replicaConfiguration.failoverTarget boolean Specifies if the replica is the failover target. If the field is set to true the replica will be designated as a failover replica. In case the master instance fails, the replica instance will be promoted as the new master instance.

Only one replica can be specified as failover target, and the replica has to be in different zone with the master instance.

replicaConfiguration.kind string This is always sql#replicaConfiguration.
replicaConfiguration.mysqlReplicaConfiguration nested object MySQL specific configuration when replicating from a MySQL on-premises master. Replication configuration information such as the username, password, certificates, and keys are not stored in the instance metadata. The configuration information is used only to set up the replication connection and is stored by MySQL in a file named in the data directory. writable
replicaConfiguration.mysqlReplicaConfiguration.caCertificate string PEM representation of the trusted CA's x509 certificate. writable
replicaConfiguration.mysqlReplicaConfiguration.clientCertificate string PEM representation of the slave's x509 certificate. writable
replicaConfiguration.mysqlReplicaConfiguration.clientKey string PEM representation of the slave's private key. The corresponsing public key is encoded in the client's certificate. writable
replicaConfiguration.mysqlReplicaConfiguration.connectRetryInterval integer Seconds to wait between connect retries. MySQL's default is 60 seconds. writable
replicaConfiguration.mysqlReplicaConfiguration.dumpFilePath string Path to a SQL dump file in Google Cloud Storage from which the slave instance is to be created. The URI is in the form gs://bucketName/fileName. Compressed gzip files (.gz) are also supported. Dumps should have the binlog co-ordinates from which replication should begin. This can be accomplished by setting --master-data to 1 when using mysqldump. writable
replicaConfiguration.mysqlReplicaConfiguration.kind string This is always sql#mysqlReplicaConfiguration.
replicaConfiguration.mysqlReplicaConfiguration.masterHeartbeatPeriod long Interval in milliseconds between replication heartbeats. writable
replicaConfiguration.mysqlReplicaConfiguration.password string The password for the replication connection. writable
replicaConfiguration.mysqlReplicaConfiguration.sslCipher string A list of permissible ciphers to use for SSL encryption. writable
replicaConfiguration.mysqlReplicaConfiguration.username string The username for the replication connection. writable
replicaConfiguration.mysqlReplicaConfiguration.verifyServerCertificate boolean Whether or not to check the master's Common Name value in the certificate that it sends during the SSL handshake. writable
replicaNames[] list The replicas of the instance.
serverCaCert nested object SSL configuration.
serviceAccountEmailAddress string The service account email address assigned to the instance. This property is applicable only to Second Generation instances.
settings nested object The user settings.
settings.activationPolicy string The activation policy specifies when the instance is activated; it is applicable only when the instance state is RUNNABLE. Valid values:
ALWAYS: The instance is on, and remains so even in the absence of connection requests.
NEVER: The instance is off; it is not activated, even if a connection request arrives.
ON_DEMAND: First Generation instances only. The instance responds to incoming requests, and turns itself off when not in use. Instances with PER_USE pricing turn off after 15 minutes of inactivity. Instances with PER_PACKAGE pricing turn off after 12 hours of inactivity.
settings.authorizedGaeApplications[] list The App Engine app IDs that can access this instance. First Generation instances only. writable
settings.availabilityType string Availability type (PostgreSQL instances only). Potential values:
ZONAL: The instance serves data from only one zone. Outages in that zone affect data accessibility.
REGIONAL: The instance can serve data from more than one zone in a region (it is highly available).
For more information, see Overview of the High Availability Configuration.
settings.backupConfiguration nested object The daily backup configuration for the instance. writable
settings.backupConfiguration.binaryLogEnabled boolean Whether binary log is enabled. If backup configuration is disabled, binary log must be disabled as well. writable
settings.backupConfiguration.enabled boolean Whether this configuration is enabled. writable
settings.backupConfiguration.kind string This is always sql#backupConfiguration.
settings.backupConfiguration.replicationLogArchivingEnabled boolean Reserved for future use. writable
settings.backupConfiguration.startTime string Start time for the daily backup configuration in UTC timezone in the 24 hour format - HH:MM. writable
settings.backupConfiguration.location string The location of the backup (regional or multi-regional). For a complete list of valid values, see Instance Locations. For example, northamerica-northeast1. writable
settings.crashSafeReplicationEnabled boolean Configuration specific to read replica instances. Indicates whether database flags for crash-safe replication are enabled. This property is only applicable to First Generation instances. writable
settings.dataDiskSizeGb long The size of data disk, in GB. The data disk size minimum is 10GB. Not used for First Generation instances. writable
settings.dataDiskType string The type of data disk: PD_SSD (default) or PD_HDD. Not used for First Generation instances. writable
settings.databaseFlags[] list The database flags passed to the instance at startup. writable
settings.databaseFlags[].name string The name of the flag. These flags are passed at instance startup, so include both server options and system variables for MySQL. Flags should be specified with underscores, not hyphens. For more information, see Configuring Database Flags in the Cloud SQL documentation.
settings.databaseFlags[].value string The value of the flag. Booleans should be set to on for true and off for false. This field must be omitted if the flag doesn't take a value.
settings.databaseReplicationEnabled boolean Configuration specific to read replica instances. Indicates whether replication is enabled or not. writable
settings.ipConfiguration nested object The settings for IP Management. This allows to enable or disable the instance IP and manage which external networks can connect to the instance. The IPv4 address cannot be disabled for Second Generation instances. writable
settings.ipConfiguration.authorizedNetworks[] list The list of external networks that are allowed to connect to the instance using the IP. In CIDR notation, also known as 'slash' notation (e.g. writable
settings.ipConfiguration.authorizedNetworks[].expirationTime datetime The time when this access control entry expires in RFC 3339 format, for example 2012-11-15T16:19:00.094Z. writable
settings.ipConfiguration.authorizedNetworks[].kind string This is always sql#aclEntry.
settings.ipConfiguration.authorizedNetworks[].name string An optional label to identify this entry. writable
settings.ipConfiguration.authorizedNetworks[].value string The whitelisted value for the access control list. For example, to grant access to a client from an external IP (IPv4 or IPv6) address or subnet, use that address or subnet here. writable
settings.ipConfiguration.ipv4Enabled boolean Whether the instance should be assigned an IP address or not. writable
settings.ipConfiguration.privateNetwork string The resource link for the VPC network from which the Cloud SQL instance is accessible for private IP. For example, /projects/myProject/global/networks/default. This setting can be updated, but it cannot be removed after it is set. writable
settings.ipConfiguration.requireSsl boolean Whether SSL connections over IP should be enforced or not. writable
settings.kind string This is always sql#settings.
settings.locationPreference nested object The location preference settings. This allows the instance to be located as near as possible to either an App Engine app or Compute Engine zone for better performance. App Engine co-location is only applicable to First Generation instances. writable
settings.locationPreference.followGaeApplication string The App Engine application to follow, it must be in the same region as the Cloud SQL instance. writable
settings.locationPreference.kind string This is always sql#locationPreference. string The preferred Compute Engine zone (e.g. us-central1-a, us-central1-b, etc.). writable
settings.maintenanceWindow nested object The maintenance window for this instance. This specifies when the instance can be restarted for maintenance purposes. Not used for First Generation instances. writable integer day of week (1-7), starting on Monday. writable
settings.maintenanceWindow.hour integer hour of day - 0 to 23. writable
settings.maintenanceWindow.kind string This is always sql#maintenanceWindow.
settings.maintenanceWindow.updateTrack string Maintenance timing setting: canary (Earlier) or stable (Later).
Learn more.
settings.pricingPlan string The pricing plan for this instance. This can be either PER_USE or PACKAGE. Only PER_USE is supported for Second Generation instances. writable
settings.replicationType string The type of replication this instance uses. This can be either ASYNCHRONOUS or SYNCHRONOUS. writable
settings.settingsVersion long The version of instance settings. This is a required field for update method to make sure concurrent updates are handled properly. During update, use the most recent settingsVersion value for this instance and do not try to update this value.
settings.storageAutoResize boolean Configuration to increase storage size automatically. The default value is true. Not used for First Generation instances. writable
settings.storageAutoResizeLimit long The maximum size to which storage capacity can be automatically increased. The default value is 0, which specifies that there is no limit. Not used for First Generation instances. writable
settings.tier string The tier (or machine type) for this instance, for example db-n1-standard-1 (MySQL instances) or db-custom-1-3840 (PostgreSQL instances). For MySQL instances, this property determines whether the instance is First or Second Generation. For more information, see Instance Settings. writable
settings.userLabels object User-provided labels, represented as a dictionary where each label is a single key value pair. writable
settings.userLabels.(key) string An individual label entry, composed of a key and a value. writable
state string The current serving state of the Cloud SQL instance. This can be one of the following.
RUNNABLE: The instance is running, or is ready to run when accessed.
SUSPENDED: The instance is not available, for example due to problems with billing.
PENDING_CREATE: The instance is being created.
MAINTENANCE: The instance is down for maintenance.
FAILED: The instance creation failed.
UNKNOWN_STATE: The state of the instance is unknown.
suspensionReason[] list If the instance state is SUSPENDED, the reason for the suspension. Potential values: BILLING_ISSUE, INTERNAL_MAINTENANCE, and OPERATIONAL_ISSUE.


Add a new trusted Certificate Authority (CA) version for the specified instance. Required to prepare for a certificate rotation. If a CA version was previously added but never used in a certificate rotation, this operation replaces that version. There cannot be more than one CA version waiting to be rotated in.
Creates a Cloud SQL instance as a clone of the source instance.
Deletes a Cloud SQL instance.
Demotes the stand-alone instance to be a Cloud SQL read replica for an external database server.
Exports data from a Cloud SQL instance to a Cloud Storage bucket as a SQL dump or CSV file.
Failover the instance to its failover replica instance.
Retrieves a resource containing information about a Cloud SQL instance.
Imports data into a Cloud SQL instance from a SQL dump or CSV file in Cloud Storage.
Creates a new Cloud SQL instance.
Lists instances under a given project in alphabetical order by instance name.
Lists all of the trusted Certificate Authorities (CAs) for the specified instance. There can be up to three CAs listed: the CA that was used to sign the certificate that is currently in use, a CA that has been added but not yet used to sign a certificate, and a CA used to sign a certificate that has previously rotated out.
Updates settings of a Cloud SQL instance. . This method supports patch semantics.
Promotes the read replica instance to be a stand-alone Cloud SQL instance.
Deletes all client certificates and generates a new server SSL certificate for the instance.
Restarts a Cloud SQL instance.
Restores a backup of a Cloud SQL instance.
Rotates the server certificate to one signed by the Certificate Authority (CA) version previously added with the addServerCA method.
Starts the replication in the read replica instance.
Stops the replication in the read replica instance.
Truncate MySQL general and slow query log tables
Updates settings of a Cloud SQL instance.
Esta página foi útil? Conte sua opinião sobre:

Enviar comentários sobre…

Cloud SQL for PostgreSQL