- Resource: DatabaseInstance
- SqlInstanceState
- Settings
- SqlAvailabilityType
- SqlPricingPlan
- SqlReplicationType
- SqlActivationPolicy
- IpConfiguration
- AclEntry
- LocationPreference
- DatabaseFlags
- SqlDataDiskType
- MaintenanceWindow
- SqlUpdateTrack
- BackupConfiguration
- BackupRetentionSettings
- RetentionUnit
- DenyMaintenancePeriod
- InsightsConfig
- IpMapping
- SqlIpAddressType
- SqlInstanceType
- OnPremisesConfiguration
- ReplicaConfiguration
- MySqlReplicaConfiguration
- SqlBackendType
- SqlSuspensionReason
- SqlScheduledMaintenance
- Methods
Resource: DatabaseInstance
A Cloud SQL instance resource.
JSON representation | |
---|---|
{ "kind": string, "state": enum ( |
Fields | |
---|---|
kind |
This is always sql#instance. |
state |
The current serving state of the Cloud SQL instance. This can be one of the following. |
databaseVersion |
The database engine type and version. The databaseVersion field cannot be changed after instance creation. |
settings |
The user settings. |
etag |
This field is deprecated and will be removed from a future version of the API. Use the settings.settingsVersion field instead. |
failoverReplica |
The name and status of the failover replica. This property is applicable only to Second Generation instances. |
failoverReplica.name |
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. |
failoverReplica.available |
The availability status of the failover replica. A false status indicates that the failover replica is out of sync. The primary instance can only failover to the failover replica when the status is true. |
masterInstanceName |
The name of the instance which will act as primary in the replication setup. |
replicaNames[] |
The replicas of the instance. |
maxDiskSize |
The maximum disk size of the instance in bytes. |
currentDiskSize |
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. |
ipAddresses[] |
The assigned IP addresses for the instance. |
serverCaCert |
SSL configuration. |
instanceType |
The instance type. This can be one of the following. |
project |
The project ID of the project containing the Cloud SQL instance. The Google apps domain is prefixed if applicable. |
ipv6Address |
The IPv6 address assigned to the instance. (Deprecated) This property was applicable only to First Generation instances. |
serviceAccountEmailAddress |
The service account email address assigned to the instance. This property is applicable only to Second Generation instances. |
onPremisesConfiguration |
Configuration specific to on-premises instances. |
replicaConfiguration |
Configuration specific to failover replicas and read replicas. |
backendType |
|
selfLink |
The URI of this resource. |
suspensionReason[] |
If the instance state is SUSPENDED, the reason for the suspension. |
connectionName |
Connection name of the Cloud SQL instance used in connection strings. |
name |
Name of the Cloud SQL instance. This does not include the project ID. |
region |
The geographical region. Can be |
gceZone |
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. |
secondaryGceZone |
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. Reserved for future use. |
diskEncryptionConfiguration |
Disk encryption configuration specific to an instance. Applies only to Second Generation instances. |
diskEncryptionStatus |
Disk encryption status specific to an instance. Applies only to Second Generation instances. |
rootPassword |
Initial root password. Use only on creation. |
scheduledMaintenance |
The start time of any upcoming scheduled maintenance for this instance. |
satisfiesPzs |
The status indicating if instance satisfiesPzs. Reserved for future use. |
SqlInstanceState
The current serving state of the database instance.
Enums | |
---|---|
SQL_INSTANCE_STATE_UNSPECIFIED |
The state of the instance is unknown. |
RUNNABLE |
The instance is running, or has been stopped by owner. |
SUSPENDED |
The instance is not available, for example due to problems with billing. |
PENDING_DELETE |
The instance is being deleted. |
PENDING_CREATE |
The instance is being created. |
MAINTENANCE |
The instance is down for maintenance. |
FAILED |
The creation of the instance failed or a fatal error occurred during maintenance. |
Settings
Database instance settings.
JSON representation | |
---|---|
{ "settingsVersion": string, "authorizedGaeApplications": [ string ], "tier": string, "kind": string, "userLabels": { string: string, ... }, "availabilityType": enum ( |
Fields | |
---|---|
settingsVersion |
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. |
authorizedGaeApplications[] |
The App Engine app IDs that can access this instance. (Deprecated) Applied to First Generation instances only. |
tier |
The machine type for this instance, for example: db-custom-1-3840. |
kind |
This is always sql#settings. |
userLabels |
User-provided labels, represented as a dictionary where each label is a single key value pair. An object containing a list of |
availabilityType |
Availability type. Potential values: |
pricingPlan |
The pricing plan for this instance. This can be either PER_USE or PACKAGE. Only PER_USE is supported for Second Generation instances. |
replicationType |
The type of replication this instance uses. This can be either ASYNCHRONOUS or SYNCHRONOUS. (Deprecated_ This property was only applicable to First Generation instances. |
storageAutoResizeLimit |
The maximum size to which storage capacity can be automatically increased. The default value is 0, which specifies that there is no limit. |
activationPolicy |
The activation policy specifies when the instance is activated; it is applicable only when the instance state is RUNNABLE. Valid values: |
ipConfiguration |
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. |
storageAutoResize |
Configuration to increase storage size automatically. The default value is true. |
locationPreference |
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 was only applicable to First Generation instances. |
databaseFlags[] |
The database flags passed to the instance at startup. |
dataDiskType |
The type of data disk: PD_SSD (default) or PD_HDD. Not used for First Generation instances. |
maintenanceWindow |
The maintenance window for this instance. This specifies when the instance can be restarted for maintenance purposes. |
backupConfiguration |
The daily backup configuration for the instance. |
databaseReplicationEnabled |
Configuration specific to read replica instances. Indicates whether replication is enabled or not. |
crashSafeReplicationEnabled |
Configuration specific to read replica instances. Indicates whether database flags for crash-safe replication are enabled. This property was only applicable to First Generation instances. |
dataDiskSizeGb |
The size of data disk, in GB. The data disk size minimum is 10GB. |
collation |
The name of server Instance collation. |
denyMaintenancePeriods[] |
Deny maintenance periods |
insightsConfig |
Insights configuration, for now relevant only for Postgres. |
SqlAvailabilityType
The availability type of the given Cloud SQL instance.
Enums | |
---|---|
SQL_AVAILABILITY_TYPE_UNSPECIFIED |
This is an unknown Availability type. |
ZONAL |
Zonal available instance. |
REGIONAL |
Regional available instance. |
SqlPricingPlan
The pricing plan for this instance.
Enums | |
---|---|
SQL_PRICING_PLAN_UNSPECIFIED |
This is an unknown pricing plan for this instance. |
PACKAGE |
The instance is billed at a monthly flat rate. |
PER_USE |
The instance is billed per usage. |
SqlReplicationType
Enums | |
---|---|
SQL_REPLICATION_TYPE_UNSPECIFIED |
This is an unknown replication type for a Cloud SQL instance. |
SYNCHRONOUS |
The synchronous replication mode for First Generation instances. It is the default value. |
ASYNCHRONOUS |
The asynchronous replication mode for First Generation instances. It provides a slight performance gain, but if an outage occurs while this option is set to asynchronous, you can lose up to a few seconds of updates to your data. |
SqlActivationPolicy
Specifies when the instance is activated.
Enums | |
---|---|
SQL_ACTIVATION_POLICY_UNSPECIFIED |
Unknown activation plan. |
ALWAYS |
The instance is always up and running. |
NEVER |
The instance never starts. |
ON_DEMAND |
The instance starts upon receiving requests. |
IpConfiguration
IP Management configuration.
JSON representation | |
---|---|
{
"ipv4Enabled": boolean,
"privateNetwork": string,
"requireSsl": boolean,
"authorizedNetworks": [
{
object ( |
Fields | |
---|---|
ipv4Enabled |
Whether the instance is assigned a public IP address or not. |
privateNetwork |
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. |
requireSsl |
Whether SSL connections over IP are enforced or not. |
authorizedNetworks[] |
The list of external networks that are allowed to connect to the instance using the IP. In 'CIDR' notation, also known as 'slash' notation (for example: 192.168.100.0/24). |
AclEntry
An entry for an Access Control list.
JSON representation | |
---|---|
{ "value": string, "expirationTime": string, "name": string, "kind": string } |
Fields | |
---|---|
value |
The allowlisted value for the access control list. |
expirationTime |
The time when this access control entry expires in RFC 3339 format, for example 2012-11-15T16:19:00.094Z. A timestamp in RFC3339 UTC "Zulu" format, with nanosecond resolution and up to nine fractional digits. Examples: |
name |
Optional. A label to identify this entry. |
kind |
This is always sql#aclEntry. |
LocationPreference
Preferred location. This specifies where a Cloud SQL instance is located, either in a specific Compute Engine zone, or co-located with an App Engine application. Note that if the preferred location is not available, the instance will be located as close as possible within the region. Only one location may be specified.
JSON representation | |
---|---|
{ "followGaeApplication": string, "zone": string, "secondaryZone": string, "kind": string } |
Fields | |
---|---|
followGaeApplication |
The App Engine application to follow, it must be in the same region as the Cloud SQL instance. |
zone |
The preferred Compute Engine zone (for example: us-central1-a, us-central1-b, etc.). |
secondaryZone |
The preferred Compute Engine zone for the secondary/failover (for example: us-central1-a, us-central1-b, etc.). Reserved for future use. |
kind |
This is always sql#locationPreference. |
DatabaseFlags
Database flags for Cloud SQL instances.
JSON representation | |
---|---|
{ "name": string, "value": string } |
Fields | |
---|---|
name |
The name of the flag. These flags are passed at instance startup, so include both server options and system variables for MySQL. Flags are specified with underscores, not hyphens. For more information, see Configuring Database Flags in the Cloud SQL documentation. |
value |
The value of the flag. Booleans are set to on for true and off for false. This field must be omitted if the flag doesn't take a value. |
SqlDataDiskType
The type of disk that is used for a v2 instance to use.
Enums | |
---|---|
SQL_DATA_DISK_TYPE_UNSPECIFIED |
This is an unknown data disk type. |
PD_SSD |
An SSD data disk. |
PD_HDD |
An HDD data disk. |
OBSOLETE_LOCAL_SSD |
This field is deprecated and will be removed from a future version of the API. |
MaintenanceWindow
Maintenance window. This specifies when a Cloud SQL instance is restarted for system maintenance purposes.
JSON representation | |
---|---|
{
"hour": integer,
"day": integer,
"updateTrack": enum ( |
Fields | |
---|---|
hour |
hour of day - 0 to 23. |
day |
day of week (1-7), starting on Monday. |
updateTrack |
Maintenance timing setting: canary (Earlier) or stable (Later). |
kind |
This is always sql#maintenanceWindow. |
SqlUpdateTrack
Enums | |
---|---|
SQL_UPDATE_TRACK_UNSPECIFIED |
This is an unknown maintenance timing preference. |
canary |
For instance update that requires a restart, this update track indicates your instance prefer to restart for new version early in maintenance window. |
stable |
For instance update that requires a restart, this update track indicates your instance prefer to let Cloud SQL choose the timing of restart (within its Maintenance window, if applicable). |
BackupConfiguration
Database instance backup configuration.
JSON representation | |
---|---|
{
"startTime": string,
"enabled": boolean,
"kind": string,
"binaryLogEnabled": boolean,
"replicationLogArchivingEnabled": boolean,
"location": string,
"pointInTimeRecoveryEnabled": boolean,
"transactionLogRetentionDays": integer,
"backupRetentionSettings": {
object ( |
Fields | |
---|---|
startTime |
Start time for the daily backup configuration in UTC timezone in the 24 hour format - HH:MM. |
enabled |
Whether this configuration is enabled. |
kind |
This is always sql#backupConfiguration. |
binaryLogEnabled |
(MySQL only) Whether binary log is enabled. If backup configuration is disabled, binarylog must be disabled as well. |
replicationLogArchivingEnabled |
Reserved for future use. |
location |
Location of the backup |
pointInTimeRecoveryEnabled |
Reserved for future use. |
transactionLogRetentionDays |
The number of days of transaction logs we retain for point in time restore, from 1-7. |
backupRetentionSettings |
Backup retention settings. |
BackupRetentionSettings
We currently only support backup retention by specifying the number of backups we will retain.
JSON representation | |
---|---|
{
"retentionUnit": enum ( |
Fields | |
---|---|
retentionUnit |
The unit that 'retainedBackups' represents. |
retainedBackups |
Depending on the value of retentionUnit, this is used to determine if a backup needs to be deleted. If retentionUnit is 'COUNT', we will retain this many backups. |
RetentionUnit
The units that retainedBackups specifies, we only support COUNT.
Enums | |
---|---|
RETENTION_UNIT_UNSPECIFIED |
Backup retention unit is unspecified, will be treated as COUNT. |
COUNT |
Retention will be by count, eg. "retain the most recent 7 backups". |
DenyMaintenancePeriod
Deny Maintenance Periods. This specifies a date range during when all CSA rollout will be denied.
JSON representation | |
---|---|
{ "startDate": string, "endDate": string, "time": string } |
Fields | |
---|---|
startDate |
"deny maintenance period" start date. If the year of the start date is empty, the year of the end date also must be empty. In this case, it means the deny maintenance period recurs every year. The date is in format yyyy-mm-dd i.e., 2020-11-01, or mm-dd, i.e., 11-01 |
endDate |
"deny maintenance period" end date. If the year of the end date is empty, the year of the start date also must be empty. In this case, it means the deny maintenance period recurs every year. The date is in format yyyy-mm-dd i.e., 2020-11-01, or mm-dd, i.e., 11-01 |
time |
Time in UTC when the "deny maintenance period" starts on startDate and ends on endDate. The time is in format: HH:mm:SS, i.e., 00:00:00 |
InsightsConfig
Insights configuration. This specifies when Cloud SQL Insights feature is enabled and optional configuration.
JSON representation | |
---|---|
{ "queryInsightsEnabled": boolean, "recordClientAddress": boolean, "recordApplicationTags": boolean, "queryStringLength": integer } |
Fields | |
---|---|
queryInsightsEnabled |
Whether Query Insights feature is enabled. |
recordClientAddress |
Whether Query Insights will record client address when enabled. |
recordApplicationTags |
Whether Query Insights will record application tags from query when enabled. |
queryStringLength |
Maximum query length stored in bytes. Default value: 1024 bytes. Range: 256-4500 bytes. Query length more than this field value will be truncated to this value. When unset, query length will be the default value. Changing query length will restart the database. |
IpMapping
Database instance IP Mapping.
JSON representation | |
---|---|
{
"type": enum ( |
Fields | |
---|---|
type |
The type of this IP address. A PRIMARY address is a public address that can accept incoming connections. A PRIVATE address is a private address that can accept incoming connections. An OUTGOING address is the source address of connections originating from the instance, if supported. |
ipAddress |
The IP address assigned. |
timeToRetire |
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. A timestamp in RFC3339 UTC "Zulu" format, with nanosecond resolution and up to nine fractional digits. Examples: |
SqlIpAddressType
Enums | |
---|---|
SQL_IP_ADDRESS_TYPE_UNSPECIFIED |
This is an unknown IP address type. |
PRIMARY |
IP address the customer is supposed to connect to. Usually this is the load balancer's IP address |
OUTGOING |
Source IP address of the connection a read replica establishes to its external primary instance. This IP address can be allowlisted by the customer in case it has a firewall that filters incoming connection to its on premises primary instance. |
PRIVATE |
Private IP used when using private IPs and network peering. |
MIGRATED_1ST_GEN |
V1 IP of a migrated instance. We want the user to decommission this IP as soon as the migration is complete. Note: V1 instances with V1 ip addresses will be counted as PRIMARY. |
SqlInstanceType
Enums | |
---|---|
SQL_INSTANCE_TYPE_UNSPECIFIED |
This is an unknown Cloud SQL instance type. |
CLOUD_SQL_INSTANCE |
A regular Cloud SQL instance. |
ON_PREMISES_INSTANCE |
An instance running on the customer's premises that is not managed by Cloud SQL. |
READ_REPLICA_INSTANCE |
A Cloud SQL instance acting as a read-replica. |
OnPremisesConfiguration
On-premises instance configuration.
JSON representation | |
---|---|
{ "hostPort": string, "kind": string, "username": string, "password": string, "caCertificate": string, "clientCertificate": string, "clientKey": string, "dumpFilePath": string } |
Fields | |
---|---|
hostPort |
The host and port of the on-premises instance in host:port format |
kind |
This is always sql#onPremisesConfiguration. |
username |
The username for connecting to on-premises instance. |
password |
The password for connecting to on-premises instance. |
caCertificate |
PEM representation of the trusted CA's x509 certificate. |
clientCertificate |
PEM representation of the replica's x509 certificate. |
clientKey |
PEM representation of the replica's private key. The corresponsing public key is encoded in the client's certificate. |
dumpFilePath |
The dump file to create the Cloud SQL replica. |
ReplicaConfiguration
Read-replica configuration for connecting to the primary instance.
JSON representation | |
---|---|
{
"kind": string,
"mysqlReplicaConfiguration": {
object ( |
Fields | |
---|---|
kind |
This is always sql#replicaConfiguration. |
mysqlReplicaConfiguration |
MySQL specific configuration when replicating from a MySQL on-premises primary instance. 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 master.info in the data directory. |
failoverTarget |
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 primary instance fails, the replica instance will be promoted as the new primary instance. Only one replica can be specified as failover target, and the replica has to be in different zone with the primary instance. |
MySqlReplicaConfiguration
Read-replica configuration specific to MySQL databases.
JSON representation | |
---|---|
{ "dumpFilePath": string, "username": string, "password": string, "connectRetryInterval": integer, "masterHeartbeatPeriod": string, "caCertificate": string, "clientCertificate": string, "clientKey": string, "sslCipher": string, "verifyServerCertificate": boolean, "kind": string } |
Fields | |
---|---|
dumpFilePath |
Path to a SQL dump file in Google Cloud Storage from which the replica instance is to be created. The URI is in the form gs://bucketName/fileName. Compressed gzip files (.gz) are also supported. Dumps have the binlog co-ordinates from which replication begins. This can be accomplished by setting --master-data to 1 when using mysqldump. |
username |
The username for the replication connection. |
password |
The password for the replication connection. |
connectRetryInterval |
Seconds to wait between connect retries. MySQL's default is 60 seconds. |
masterHeartbeatPeriod |
Interval in milliseconds between replication heartbeats. |
caCertificate |
PEM representation of the trusted CA's x509 certificate. |
clientCertificate |
PEM representation of the replica's x509 certificate. |
clientKey |
PEM representation of the replica's private key. The corresponsing public key is encoded in the client's certificate. |
sslCipher |
A list of permissible ciphers to use for SSL encryption. |
verifyServerCertificate |
Whether or not to check the primary instance's Common Name value in the certificate that it sends during the SSL handshake. |
kind |
This is always sql#mysqlReplicaConfiguration. |
SqlBackendType
Enums | |
---|---|
SQL_BACKEND_TYPE_UNSPECIFIED |
This is an unknown backend type for instance. |
FIRST_GEN |
V1 speckle instance. |
SECOND_GEN |
V2 speckle instance. |
EXTERNAL |
On premises instance. |
SqlSuspensionReason
The suspension reason of the database instance if the state is SUSPENDED.
Enums | |
---|---|
SQL_SUSPENSION_REASON_UNSPECIFIED |
This is an unknown suspension reason. |
BILLING_ISSUE |
The instance is suspended due to billing issues (for example:, GCP account issue) |
LEGAL_ISSUE |
The instance is suspended due to illegal content (for example:, child pornography, copyrighted material, etc.). |
OPERATIONAL_ISSUE |
The instance is causing operational issues (for example:, causing the database to crash). |
KMS_KEY_ISSUE |
The KMS key used by the instance is either revoked or denied access to |
SqlScheduledMaintenance
Any scheduled maintenancce for this instance.
JSON representation | |
---|---|
{ "startTime": string, "canDefer": boolean, "canReschedule": boolean } |
Fields | |
---|---|
startTime |
The start time of any upcoming scheduled maintenance for this instance. A timestamp in RFC3339 UTC "Zulu" format, with nanosecond resolution and up to nine fractional digits. Examples: |
canDefer |
|
canReschedule |
If the scheduled maintenance can be rescheduled. |
Methods |
|
---|---|
|
Add a new trusted Certificate Authority (CA) version for the specified instance. |
|
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. |
|
Lists all of the trusted Certificate Authorities (CAs) for the specified instance. |
|
Updates settings of a Cloud SQL instance. |
|
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 MySQL only. |
|
Updates settings of a Cloud SQL instance. |