instances
Creates, updates, deletes, gets or lists a instances
resource.
Overview
Name | instances |
Type | Resource |
Id | google.alloydb.instances |
Fields
Name | Datatype | Description |
---|---|---|
name | string | Output only. The name of the instance resource with the format: projects/{project}/locations/{region}/clusters/{cluster_id}/instances/{instance_id} where the cluster and instance ID segments should satisfy the regex expression [a-z]([a-z0-9-]{0,61}[a-z0-9])? , e.g. 1-63 characters of lowercase letters, numbers, and dashes, starting with a letter, and ending with a letter or number. For more details see https://google.aip.dev/122. The prefix of the instance resource name is the name of the parent resource: projects/{project}/locations/{region}/clusters/{cluster_id} |
annotations | object | Annotations to allow client tools to store small amount of arbitrary data. This is distinct from labels. https://google.aip.dev/128 |
availabilityType | string | Availability type of an Instance. If empty, defaults to REGIONAL for primary instances. For read pools, availability_type is always UNSPECIFIED. Instances in the read pools are evenly distributed across available zones within the region (i.e. read pools with more than one node will have a node in at least two zones). |
clientConnectionConfig | object | Client connection configuration |
createTime | string | Output only. Create time stamp |
databaseFlags | object | Database flags. Set at instance level. They are copied from primary instance on read instance creation. Read instances can set new or override existing flags that are relevant for reads, e.g. for enabling columnar cache on a read instance. Flags set on read instance may or may not be present on primary. This is a list of "key": "value" pairs. "key": The name of the flag. These flags are passed at instance setup time, so include both server options and system variables for Postgres. Flags are specified with underscores, not hyphens. "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. |
deleteTime | string | Output only. Delete time stamp |
displayName | string | User-settable and human-readable display name for the Instance. |
etag | string | For Resource freshness validation (https://google.aip.dev/154) |
gceZone | string | The Compute Engine zone that the instance should serve from, per https://cloud.google.com/compute/docs/regions-zones This can ONLY be specified for ZONAL instances. If present for a REGIONAL instance, an error will be thrown. If this is absent for a ZONAL instance, instance is created in a random zone with available capacity. |
instanceType | string | Required. The type of the instance. Specified at creation time. |
ipAddress | string | Output only. The IP address for the Instance. This is the connection endpoint for an end-user application. |
labels | object | Labels as key value pairs |
machineConfig | object | MachineConfig describes the configuration of a machine. |
networkConfig | object | Metadata related to instance level network configuration. |
nodes | array | Output only. List of available read-only VMs in this instance, including the standby for a PRIMARY instance. |
outboundPublicIpAddresses | array | Output only. All outbound public IP addresses configured for the instance. |
pscInstanceConfig | object | PscInstanceConfig contains PSC related configuration at an instance level. |
publicIpAddress | string | Output only. The public IP addresses for the Instance. This is available ONLY when enable_public_ip is set. This is the connection endpoint for an end-user application. |
queryInsightsConfig | object | QueryInsights Instance specific configuration. |
readPoolConfig | object | Configuration for a read pool instance. |
reconciling | boolean | Output only. Reconciling (https://google.aip.dev/128#reconciliation). Set to true if the current state of Instance does not match the user's intended state, and the service is actively updating the resource to reconcile them. This can happen due to user-triggered updates or system actions like failover or maintenance. |
satisfiesPzs | boolean | Output only. Reserved for future use. |
state | string | Output only. The current serving state of the instance. |
uid | string | Output only. The system-generated UID of the resource. The UID is assigned when the resource is created, and it is retained until it is deleted. |
updateTime | string | Output only. Update time stamp |
writableNode | object | Details of a single node in the instance. Nodes in an AlloyDB instance are ephemereal, they can change during update, failover, autohealing and resize operations. |
Methods
Name | Accessible by | Required Params | Description |
---|---|---|---|
get | SELECT | clustersId, instancesId, locationsId, projectsId | Gets details of a single Instance. |
list | SELECT | clustersId, locationsId, projectsId | Lists Instances in a given project and location. |
create | INSERT | clustersId, locationsId, projectsId | Creates a new Instance in a given project and location. |
delete | DELETE | clustersId, instancesId, locationsId, projectsId | Deletes a single Instance. |
patch | UPDATE | clustersId, instancesId, locationsId, projectsId | Updates the parameters of a single Instance. |
failover | EXEC | clustersId, instancesId, locationsId, projectsId | Forces a Failover for a highly available instance. Failover promotes the HA standby instance as the new primary. Imperative only. |
inject_fault | EXEC | clustersId, instancesId, locationsId, projectsId | Injects fault in an instance. Imperative only. |
restart | EXEC | clustersId, instancesId, locationsId, projectsId | Restart an Instance in a cluster. Imperative only. |
SELECT
examples
Lists Instances in a given project and location.
SELECT
name,
annotations,
availabilityType,
clientConnectionConfig,
createTime,
databaseFlags,
deleteTime,
displayName,
etag,
gceZone,
instanceType,
ipAddress,
labels,
machineConfig,
networkConfig,
nodes,
outboundPublicIpAddresses,
pscInstanceConfig,
publicIpAddress,
queryInsightsConfig,
readPoolConfig,
reconciling,
satisfiesPzs,
state,
uid,
updateTime,
writableNode
FROM google.alloydb.instances
WHERE clustersId = '{{ clustersId }}'
AND locationsId = '{{ locationsId }}'
AND projectsId = '{{ projectsId }}';
INSERT
example
Use the following StackQL query and manifest file to create a new instances
resource.
- All Properties
- Manifest
/*+ create */
INSERT INTO google.alloydb.instances (
clustersId,
locationsId,
projectsId,
displayName,
labels,
instanceType,
machineConfig,
availabilityType,
gceZone,
databaseFlags,
queryInsightsConfig,
readPoolConfig,
etag,
annotations,
clientConnectionConfig,
pscInstanceConfig,
networkConfig
)
SELECT
'{{ clustersId }}',
'{{ locationsId }}',
'{{ projectsId }}',
'{{ displayName }}',
'{{ labels }}',
'{{ instanceType }}',
'{{ machineConfig }}',
'{{ availabilityType }}',
'{{ gceZone }}',
'{{ databaseFlags }}',
'{{ queryInsightsConfig }}',
'{{ readPoolConfig }}',
'{{ etag }}',
'{{ annotations }}',
'{{ clientConnectionConfig }}',
'{{ pscInstanceConfig }}',
'{{ networkConfig }}'
;
- name: your_resource_model_name
props:
- name: name
value: string
- name: displayName
value: string
- name: uid
value: string
- name: createTime
value: string
- name: updateTime
value: string
- name: deleteTime
value: string
- name: labels
value: object
- name: state
value: string
- name: instanceType
value: string
- name: machineConfig
value:
- name: cpuCount
value: integer
- name: availabilityType
value: string
- name: gceZone
value: string
- name: databaseFlags
value: object
- name: writableNode
value:
- name: zoneId
value: string
- name: id
value: string
- name: ip
value: string
- name: state
value: string
- name: nodes
value:
- - name: zoneId
value: string
- name: id
value: string
- name: ip
value: string
- name: state
value: string
- name: queryInsightsConfig
value:
- name: recordApplicationTags
value: boolean
- name: recordClientAddress
value: boolean
- name: queryStringLength
value: integer
- name: queryPlansPerMinute
value: integer
- name: readPoolConfig
value:
- name: nodeCount
value: integer
- name: ipAddress
value: string
- name: publicIpAddress
value: string
- name: reconciling
value: boolean
- name: etag
value: string
- name: annotations
value: object
- name: clientConnectionConfig
value:
- name: requireConnectors
value: boolean
- name: sslConfig
value:
- name: sslMode
value: string
- name: caSource
value: string
- name: satisfiesPzs
value: boolean
- name: pscInstanceConfig
value:
- name: serviceAttachmentLink
value: string
- name: allowedConsumerProjects
value:
- string
- name: pscDnsName
value: string
- name: networkConfig
value:
- name: authorizedExternalNetworks
value:
- - name: cidrRange
value: string
- name: enablePublicIp
value: boolean
- name: enableOutboundPublicIp
value: boolean
- name: outboundPublicIpAddresses
value:
- string
UPDATE
example
Updates a instances
resource.
/*+ update */
UPDATE google.alloydb.instances
SET
displayName = '{{ displayName }}',
labels = '{{ labels }}',
instanceType = '{{ instanceType }}',
machineConfig = '{{ machineConfig }}',
availabilityType = '{{ availabilityType }}',
gceZone = '{{ gceZone }}',
databaseFlags = '{{ databaseFlags }}',
queryInsightsConfig = '{{ queryInsightsConfig }}',
readPoolConfig = '{{ readPoolConfig }}',
etag = '{{ etag }}',
annotations = '{{ annotations }}',
clientConnectionConfig = '{{ clientConnectionConfig }}',
pscInstanceConfig = '{{ pscInstanceConfig }}',
networkConfig = '{{ networkConfig }}'
WHERE
clustersId = '{{ clustersId }}'
AND instancesId = '{{ instancesId }}'
AND locationsId = '{{ locationsId }}'
AND projectsId = '{{ projectsId }}';
DELETE
example
Deletes the specified instances
resource.
/*+ delete */
DELETE FROM google.alloydb.instances
WHERE clustersId = '{{ clustersId }}'
AND instancesId = '{{ instancesId }}'
AND locationsId = '{{ locationsId }}'
AND projectsId = '{{ projectsId }}';