Creates a new Cloud SQL instance.
Scopes
You will need authorization for at least one of the following scopes to make a valid call:
- https://www.googleapis.com/auth/cloud-platform
- https://www.googleapis.com/auth/sqlservice.admin
If unset, the scope for this method defaults to https://www.googleapis.com/auth/cloud-platform.
You can set the scope for this method like this: sqladmin1-beta4 --scope <scope> instances insert ...
Required Scalar Argument
- <project> (string)
- Project ID of the project to which the newly created Cloud SQL instances should belong.
Required Request Value
The request value is a data-structure with various fields. Each field may be a simple scalar or another data-structure. In the latter case it is advised to set the field-cursor to the data-structure's field to specify values more concisely.
For example, a structure like this:
DatabaseInstance:
available-maintenance-versions: [string]
backend-type: string
connection-name: string
create-time: string
current-disk-size: string
database-installed-version: string
database-version: string
disk-encryption-configuration:
kind: string
kms-key-name: string
disk-encryption-status:
kind: string
kms-key-version-name: string
dns-name: string
etag: string
failover-replica:
available: boolean
name: string
gce-zone: string
instance-type: string
ipv6-address: string
kind: string
maintenance-version: string
master-instance-name: string
max-disk-size: string
name: string
on-premises-configuration:
ca-certificate: string
client-certificate: string
client-key: string
dump-file-path: string
host-port: string
kind: string
password: string
source-instance:
name: string
project: string
region: string
username: string
out-of-disk-report:
sql-min-recommended-increase-size-gb: integer
sql-out-of-disk-state: string
primary-dns-name: string
project: string
psc-service-attachment-link: string
region: string
replica-configuration:
cascadable-replica: boolean
failover-target: boolean
kind: string
mysql-replica-configuration:
ca-certificate: string
client-certificate: string
client-key: string
connect-retry-interval: integer
dump-file-path: string
kind: string
master-heartbeat-period: string
password: string
ssl-cipher: string
username: string
verify-server-certificate: boolean
replica-names: [string]
root-password: string
satisfies-pzs: boolean
scheduled-maintenance:
can-defer: boolean
can-reschedule: boolean
schedule-deadline-time: string
start-time: string
secondary-gce-zone: string
self-link: string
server-ca-cert:
cert: string
cert-serial-number: string
common-name: string
create-time: string
expiration-time: string
instance: string
kind: string
self-link: string
sha1-fingerprint: string
service-account-email-address: string
settings:
activation-policy: string
active-directory-config:
domain: string
kind: string
advanced-machine-features:
threads-per-core: integer
authorized-gae-applications: [string]
availability-type: string
backup-configuration:
backup-retention-settings:
retained-backups: integer
retention-unit: string
binary-log-enabled: boolean
enabled: boolean
kind: string
location: string
point-in-time-recovery-enabled: boolean
replication-log-archiving-enabled: boolean
start-time: string
transaction-log-retention-days: integer
collation: string
connector-enforcement: string
crash-safe-replication-enabled: boolean
data-cache-config:
data-cache-enabled: boolean
data-disk-size-gb: string
data-disk-type: string
database-replication-enabled: boolean
deletion-protection-enabled: boolean
edition: string
insights-config:
query-insights-enabled: boolean
query-plans-per-minute: integer
query-string-length: integer
record-application-tags: boolean
record-client-address: boolean
ip-configuration:
allocated-ip-range: string
enable-private-path-for-google-cloud-services: boolean
ipv4-enabled: boolean
private-network: string
psc-config:
allowed-consumer-projects: [string]
psc-enabled: boolean
require-ssl: boolean
ssl-mode: string
kind: string
location-preference:
follow-gae-application: string
kind: string
secondary-zone: string
zone: string
maintenance-window:
day: integer
hour: integer
kind: string
update-track: string
password-validation-policy:
complexity: string
disallow-compromised-credentials: boolean
disallow-username-substring: boolean
enable-password-policy: boolean
min-length: integer
password-change-interval: string
reuse-interval: integer
pricing-plan: string
replication-type: string
settings-version: string
sql-server-audit-config:
bucket: string
kind: string
retention-interval: string
upload-interval: string
storage-auto-resize: boolean
storage-auto-resize-limit: string
tier: string
time-zone: string
user-labels: { string: string }
sql-network-architecture: string
state: string
suspension-reason: [string]
write-endpoint: string
can be set completely with the following arguments which are assumed to be executed in the given order. Note how the cursor position is adjusted to the respective structures, allowing simple field names to be used most of the time.
-r . available-maintenance-versions=amet
- Output only. List all maintenance versions applicable on the instance
- Each invocation of this argument appends the given value to the array.
backend-type=est
- 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 thetier
property in thesettings
object to determine the database type.
- The backend type.
connection-name=et
- Connection name of the Cloud SQL instance used in connection strings.
create-time=sea
- Output only. The time when the instance was created in RFC 3339 format, for example
2012-11-15T16:19:00.094Z
.
- Output only. The time when the instance was created in RFC 3339 format, for example
current-disk-size=consetetur
- 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.
database-installed-version=consetetur
- Output only. Stores the current database version running on the instance including minor version such as
MYSQL_8_0_18
.
- Output only. Stores the current database version running on the instance including minor version such as
database-version=stet
- The database engine type and version. The
databaseVersion
field cannot be changed after instance creation.
- The database engine type and version. The
disk-encryption-configuration kind=est
- This is always
sql#diskEncryptionConfiguration
.
- This is always
-
kms-key-name=aliquyam
- Resource name of KMS key for disk encryption
-
..disk-encryption-status kind=elitr
- This is always
sql#diskEncryptionStatus
.
- This is always
-
kms-key-version-name=duo
- KMS key version used to encrypt the Cloud SQL instance resource
-
.. dns-name=diam
- Output only. The dns name of the instance.
etag=est
- This field is deprecated and will be removed from a future version of the API. Use the
settings.settingsVersion
field instead.
- This field is deprecated and will be removed from a future version of the API. Use the
failover-replica available=true
- 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.
-
name=sed
- 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.
-
.. gce-zone=eos
- 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.
instance-type=lorem
- The instance type.
ipv6-address=ea
- The IPv6 address assigned to the instance. (Deprecated) This property was applicable only to First Generation instances.
kind=stet
- This is always
sql#instance
.
- This is always
maintenance-version=dolores
- The current software version on the instance.
master-instance-name=eos
- The name of the instance which will act as primary in the replication setup.
max-disk-size=et
- The maximum disk size of the instance in bytes.
name=sea
- Name of the Cloud SQL instance. This does not include the project ID.
on-premises-configuration ca-certificate=et
- PEM representation of the trusted CA's x509 certificate.
client-certificate=at
- PEM representation of the replica's x509 certificate.
client-key=dolore
- PEM representation of the replica's private key. The corresponsing public key is encoded in the client's certificate.
dump-file-path=eirmod
- The dump file to create the Cloud SQL replica.
host-port=lorem
- The host and port of the on-premises instance in host:port format
kind=accusam
- This is always
sql#onPremisesConfiguration
.
- This is always
password=amet
- The password for connecting to on-premises instance.
source-instance name=erat
- The name of the Cloud SQL instance being referenced. This does not include the project ID.
project=dolores
- The project ID of the Cloud SQL instance being referenced. The default is the same project ID as the instance references it.
-
region=erat
- The region of the Cloud SQL instance being referenced.
-
.. username=accusam
- The username for connecting to on-premises instance.
-
..out-of-disk-report sql-min-recommended-increase-size-gb=91
- The minimum recommended increase size in GigaBytes This field is consumed by the frontend * Writers: * the proactive database wellness job for OOD. * Readers:
-
sql-out-of-disk-state=takimata
- This field represents the state generated by the proactive database wellness job for OutOfDisk issues. * Writers: * the proactive database wellness job for OOD. * Readers: * the proactive database wellness job
-
.. primary-dns-name=lorem
- Output only. DEPRECATED: please use write_endpoint instead.
project=et
- The project ID of the project containing the Cloud SQL instance. The Google apps domain is prefixed if applicable.
psc-service-attachment-link=at
- Output only. The link to service attachment of PSC instance.
region=dolor
- 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
, andus-central1
. The default value isus-central1
.
- The geographical region of the Cloud SQL instance. It can be one of the regions where Cloud SQL operates: For example,
replica-configuration cascadable-replica=true
- Optional. Specifies if a SQL Server replica is a cascadable replica. A cascadable replica is a SQL Server cross region replica that supports replica(s) under it.
failover-target=false
- 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.
- Specifies if the replica is the failover target. If the field is set to
kind=sea
- This is always
sql#replicaConfiguration
.
- This is always
mysql-replica-configuration ca-certificate=nonumy
- PEM representation of the trusted CA's x509 certificate.
client-certificate=et
- PEM representation of the replica's x509 certificate.
client-key=gubergren
- PEM representation of the replica's private key. The corresponsing public key is encoded in the client's certificate.
connect-retry-interval=80
- Seconds to wait between connect retries. MySQL's default is 60 seconds.
dump-file-path=sea
- 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.
kind=consetetur
- This is always
sql#mysqlReplicaConfiguration
.
- This is always
master-heartbeat-period=sit
- Interval in milliseconds between replication heartbeats.
password=aliquyam
- The password for the replication connection.
ssl-cipher=eos
- A list of permissible ciphers to use for SSL encryption.
username=at
- The username for the replication connection.
-
verify-server-certificate=true
- Whether or not to check the primary instance's Common Name value in the certificate that it sends during the SSL handshake.
-
... replica-names=gubergren
- The replicas of the instance.
- Each invocation of this argument appends the given value to the array.
root-password=dolor
- Initial root password. Use only on creation. You must set root passwords before you can connect to PostgreSQL instances.
satisfies-pzs=true
- The status indicating if instance satisfiesPzs. Reserved for future use.
scheduled-maintenance can-defer=true
- No description provided.
can-reschedule=true
- If the scheduled maintenance can be rescheduled.
schedule-deadline-time=accusam
- Maintenance cannot be rescheduled to start beyond this deadline.
-
start-time=gubergren
- The start time of any upcoming scheduled maintenance for this instance.
-
.. secondary-gce-zone=sadipscing
- 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.
self-link=at
- The URI of this resource.
server-ca-cert cert=sit
- PEM representation.
cert-serial-number=duo
- Serial number, as extracted from the certificate.
common-name=sit
- User supplied name. Constrained to [a-zA-Z.-_ ]+.
create-time=magna
- The time when the certificate was created in RFC 3339 format, for example
2012-11-15T16:19:00.094Z
.
- The time when the certificate was created in RFC 3339 format, for example
expiration-time=et
- The time when the certificate expires in RFC 3339 format, for example
2012-11-15T16:19:00.094Z
.
- The time when the certificate expires in RFC 3339 format, for example
instance=rebum.
- Name of the database instance.
kind=dolor
- This is always
sql#sslCert
.
- This is always
self-link=lorem
- The URI of this resource.
-
sha1-fingerprint=justo
- Sha1 Fingerprint.
-
.. service-account-email-address=amet.
- The service account email address assigned to the instance. \This property is read-only.
settings activation-policy=no
- 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.
- The activation policy specifies when the instance is activated; it is applicable only when the instance state is RUNNABLE. Valid values: *
active-directory-config domain=nonumy
- The name of the domain (e.g., mydomain.com).
-
kind=sed
- This is always sql#activeDirectoryConfig.
-
..advanced-machine-features threads-per-core=88
- The number of threads per physical core.
-
.. authorized-gae-applications=lorem
- The App Engine app IDs that can access this instance. (Deprecated) Applied to First Generation instances only.
- Each invocation of this argument appends the given value to the array.
availability-type=sanctus
- Availability type. 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.
- Availability type. Potential values: *
backup-configuration.backup-retention-settings retained-backups=10
- Depending on the value of retention_unit, this is used to determine if a backup needs to be deleted. If retention_unit is 'COUNT', we will retain this many backups.
-
retention-unit=rebum.
- The unit that 'retained_backups' represents.
-
.. binary-log-enabled=true
- (MySQL only) Whether binary log is enabled. If backup configuration is disabled, binarylog must be disabled as well.
enabled=true
- Whether this configuration is enabled.
kind=dolore
- This is always
sql#backupConfiguration
.
- This is always
location=amet
- Location of the backup
point-in-time-recovery-enabled=true
- Whether point in time recovery is enabled.
replication-log-archiving-enabled=false
- Reserved for future use.
start-time=duo
- Start time for the daily backup configuration in UTC timezone in the 24 hour format -
HH:MM
.
- Start time for the daily backup configuration in UTC timezone in the 24 hour format -
-
transaction-log-retention-days=56
- The number of days of transaction logs we retain for point in time restore, from 1-7.
-
.. collation=ut
- The name of server Instance collation.
connector-enforcement=rebum.
- Specifies if connections must use Cloud SQL connectors. Option values include the following:
NOT_REQUIRED
(Cloud SQL instances can be connected without Cloud SQL Connectors) andREQUIRED
(Only allow connections that use Cloud SQL Connectors) Note that using REQUIRED disables all existing authorized networks. If this field is not specified when creating a new instance, NOT_REQUIRED is used. If this field is not specified when patching or updating an existing instance, it is left unchanged in the instance.
- Specifies if connections must use Cloud SQL connectors. Option values include the following:
crash-safe-replication-enabled=false
- 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.
-
data-cache-config data-cache-enabled=true
- Whether data cache is enabled for the instance.
-
.. data-disk-size-gb=sadipscing
- The size of data disk, in GB. The data disk size minimum is 10GB.
data-disk-type=tempor
- The type of data disk:
PD_SSD
(default) orPD_HDD
. Not used for First Generation instances.
- The type of data disk:
database-replication-enabled=false
- Configuration specific to read replica instances. Indicates whether replication is enabled or not. WARNING: Changing this restarts the instance.
deletion-protection-enabled=true
- Configuration to protect against accidental instance deletion.
edition=magna
- Optional. The edition of the instance.
insights-config query-insights-enabled=true
- Whether Query Insights feature is enabled.
query-plans-per-minute=35
- Number of query execution plans captured by Insights per minute for all queries combined. Default is 5.
query-string-length=74
- 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.
record-application-tags=false
- Whether Query Insights will record application tags from query when enabled.
-
record-client-address=false
- Whether Query Insights will record client address when enabled.
-
..ip-configuration allocated-ip-range=ut
- The name of the allocated ip range for the private ip Cloud SQL instance. For example: "google-managed-services-default". If set, the instance ip will be created in the allocated range. The range name must comply with RFC 1035. Specifically, the name must be 1-63 characters long and match the regular expression
[a-z]([-a-z0-9]*[a-z0-9])?.
- The name of the allocated ip range for the private ip Cloud SQL instance. For example: "google-managed-services-default". If set, the instance ip will be created in the allocated range. The range name must comply with RFC 1035. Specifically, the name must be 1-63 characters long and match the regular expression
enable-private-path-for-google-cloud-services=false
- Controls connectivity to private IP instances from Google services, such as BigQuery.
ipv4-enabled=true
- Whether the instance is assigned a public IP address or not.
private-network=clita
- 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.
- The resource link for the VPC network from which the Cloud SQL instance is accessible for private IP. For example,
psc-config allowed-consumer-projects=dolor
- Optional. The list of consumer projects that are allow-listed for PSC connections to this instance. This instance can be connected to with PSC from any network in these projects. Each consumer project in this list may be represented by a project number (numeric) or by a project id (alphanumeric).
- Each invocation of this argument appends the given value to the array.
-
psc-enabled=false
- Whether PSC connectivity is enabled for this instance.
-
.. require-ssl=false
- Use
ssl_mode
instead for MySQL and PostgreSQL. SQL Server uses this flag. Whether SSL/TLS connections over IP are enforced. If set to false, then allow both non-SSL/non-TLS and SSL/TLS connections. For SSL/TLS connections, the client certificate won't be verified. If set to true, then only allow connections encrypted with SSL/TLS and with valid client certificates. If you want to enforce SSL/TLS without enforcing the requirement for valid client certificates, then use thessl_mode
flag instead of the legacyrequire_ssl
flag.
- Use
-
ssl-mode=diam
- Specify how SSL/TLS is enforced in database connections. MySQL and PostgreSQL use the
ssl_mode
flag. If you must use therequire_ssl
flag for backward compatibility, then only the following value pairs are valid: *ssl_mode=ALLOW_UNENCRYPTED_AND_ENCRYPTED
andrequire_ssl=false
*ssl_mode=ENCRYPTED_ONLY
andrequire_ssl=false
*ssl_mode=TRUSTED_CLIENT_CERTIFICATE_REQUIRED
andrequire_ssl=true
The value ofssl_mode
gets priority over the value ofrequire_ssl
. For example, for the pairssl_mode=ENCRYPTED_ONLY
andrequire_ssl=false
, thessl_mode=ENCRYPTED_ONLY
means only accept SSL connections, while therequire_ssl=false
means accept both non-SSL and SSL connections. MySQL and PostgreSQL databases respectssl_mode
in this case and accept only SSL connections. SQL Server uses therequire_ssl
flag. You can set the value for this flag totrue
orfalse
.
- Specify how SSL/TLS is enforced in database connections. MySQL and PostgreSQL use the
-
.. kind=nonumy
- This is always
sql#settings
.
- This is always
location-preference follow-gae-application=et
- The App Engine application to follow, it must be in the same region as the Cloud SQL instance. WARNING: Changing this might restart the instance.
kind=sanctus
- This is always
sql#locationPreference
.
- This is always
secondary-zone=accusam
- The preferred Compute Engine zone for the secondary/failover (for example: us-central1-a, us-central1-b, etc.). To disable this field, set it to 'no_secondary_zone'.
-
zone=tempor
- The preferred Compute Engine zone (for example: us-central1-a, us-central1-b, etc.). WARNING: Changing this might restart the instance.
-
..maintenance-window day=58
- day of week (1-7), starting on Monday.
hour=94
- hour of day - 0 to 23.
kind=takimata
- This is always
sql#maintenanceWindow
.
- This is always
-
update-track=dolor
- Maintenance timing setting:
canary
(Earlier) orstable
(Later). Learn more.
- Maintenance timing setting:
-
..password-validation-policy complexity=diam
- The complexity of the password.
disallow-compromised-credentials=false
- This field is deprecated and will be removed in a future version of the API.
disallow-username-substring=false
- Disallow username as a part of the password.
enable-password-policy=false
- Whether the password policy is enabled or not.
min-length=96
- Minimum number of characters allowed.
password-change-interval=accusam
- Minimum interval after which the password can be changed. This flag is only supported for PostgreSQL.
-
reuse-interval=82
- Number of previous passwords that cannot be reused.
-
.. pricing-plan=consetetur
- The pricing plan for this instance. This can be either
PER_USE
orPACKAGE
. OnlyPER_USE
is supported for Second Generation instances.
- The pricing plan for this instance. This can be either
replication-type=no
- The type of replication this instance uses. This can be either
ASYNCHRONOUS
orSYNCHRONOUS
. (Deprecated) This property was only applicable to First Generation instances.
- The type of replication this instance uses. This can be either
settings-version=justo
- 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.
sql-server-audit-config bucket=sadipscing
- The name of the destination bucket (e.g., gs://mybucket).
kind=diam
- This is always sql#sqlServerAuditConfig
retention-interval=sea
- How long to keep generated audit files.
-
upload-interval=ipsum
- How often to upload generated audit files.
-
.. storage-auto-resize=true
- Configuration to increase storage size automatically. The default value is true.
storage-auto-resize-limit=ipsum
- The maximum size to which storage capacity can be automatically increased. The default value is 0, which specifies that there is no limit.
tier=no
- The tier (or machine type) for this instance, for example
db-custom-1-3840
. WARNING: Changing this restarts the instance.
- The tier (or machine type) for this instance, for example
time-zone=sit
- Server timezone, relevant only for Cloud SQL for SQL Server.
-
user-labels=key=kasd
- User-provided labels, represented as a dictionary where each label is a single key value pair.
- the value will be associated with the given
key
-
.. sql-network-architecture=amet
- The SQL network architecture for the instance.
state=lorem
- The current serving state of the Cloud SQL instance.
suspension-reason=justo
- If the instance state is SUSPENDED, the reason for the suspension.
- Each invocation of this argument appends the given value to the array.
write-endpoint=invidunt
- Output only. The dns name of the primary instance in a replication group.
About Cursors
The cursor position is key to comfortably set complex nested structures. The following rules apply:
- The cursor position is always set relative to the current one, unless the field name starts with the
.
character. Fields can be nested such as in-r f.s.o
. - The cursor position is set relative to the top-level structure if it starts with
.
, e.g.-r .s.s
- You can also set nested fields without setting the cursor explicitly. For example, to set a value relative to the current cursor position, you would specify
-r struct.sub_struct=bar
. - You can move the cursor one level up by using
..
. Each additional.
moves it up one additional level. E.g....
would go three levels up.
Optional Output Flags
The method's return value a JSON encoded structure, which will be written to standard output by default.
- -o out
- out specifies the destination to which to write the server's result to.
It will be a JSON-encoded structure.
The destination may be
-
to indicate standard output, or a filepath that is to contain the received bytes. If unset, it defaults to standard output.
- out specifies the destination to which to write the server's result to.
It will be a JSON-encoded structure.
The destination may be
Optional General Properties
The following properties can configure any call, and are not specific to this method.
-
-p $-xgafv=string
- V1 error format.
-
-p access-token=string
- OAuth access token.
-
-p alt=string
- Data format for response.
-
-p callback=string
- JSONP
-
-p fields=string
- Selector specifying which fields to include in a partial response.
-
-p key=string
- API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
-
-p oauth-token=string
- OAuth 2.0 token for the current user.
-
-p pretty-print=boolean
- Returns response with indentations and line breaks.
-
-p quota-user=string
- Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
-
-p upload-type=string
- Legacy upload protocol for media (e.g. "media", "multipart").
-
-p upload-protocol=string
- Upload protocol for media (e.g. "raw", "multipart").