Skip to main content

clusters

Creates, updates, deletes, gets or lists a clusters resource.

Overview

Nameclusters
TypeResource
Idgoogle.alloydb.clusters

Fields

The following fields are returned by SELECT queries:

Successful response

NameDatatypeDescription
namestringOutput only. The name of the cluster resource with the format: * projects/{project}/locations/{region}/clusters/{cluster_id} where the cluster ID segment should satisfy the regex expression [a-z0-9-]+. For more details see https://google.aip.dev/122. The prefix of the cluster resource name is the name of the parent resource: * projects/{project}/locations/{region}
annotationsobjectAnnotations to allow client tools to store small amount of arbitrary data. This is distinct from labels. https://google.aip.dev/128
automatedBackupPolicyobjectThe automated backup policy for this cluster. If no policy is provided then the default policy will be used. If backups are supported for the cluster, the default policy takes one backup a day, has a backup window of 1 hour, and retains backups for 14 days. For more information on the defaults, consult the documentation for the message type. (id: AutomatedBackupPolicy)
backupSourceobjectOutput only. Cluster created from backup. (id: BackupSource)
cloudsqlBackupRunSourceobjectOutput only. Cluster created from CloudSQL snapshot. (id: CloudSQLBackupRunSource)
clusterTypestringOutput only. The type of the cluster. This is an output-only field and it's populated at the Cluster creation time or the Cluster promotion time. The cluster type is determined by which RPC was used to create the cluster (i.e. CreateCluster vs. CreateSecondaryCluster
continuousBackupConfigobjectOptional. Continuous backup configuration for this cluster. (id: ContinuousBackupConfig)
continuousBackupInfoobjectOutput only. Continuous backup properties for this cluster. (id: ContinuousBackupInfo)
createTimestring (google-datetime)Output only. Create time stamp
databaseVersionstringOptional. The database engine major version. This is an optional field and it is populated at the Cluster creation time. If a database version is not supplied at cluster creation time, then a default database version will be used.
deleteTimestring (google-datetime)Output only. Delete time stamp
displayNamestringUser-settable and human-readable display name for the Cluster.
encryptionConfigobjectOptional. The encryption config can be specified to encrypt the data disks and other persistent data resources of a cluster with a customer-managed encryption key (CMEK). When this field is not specified, the cluster will then use default encryption scheme to protect the user data. (id: EncryptionConfig)
encryptionInfoobjectOutput only. The encryption information for the cluster. (id: EncryptionInfo)
etagstringFor Resource freshness validation (https://google.aip.dev/154)
initialUserobjectInput only. Initial user to setup during cluster creation. Required. If used in RestoreCluster this is ignored. (id: UserPassword)
labelsobjectLabels as key value pairs
maintenanceScheduleobjectOutput only. The maintenance schedule for the cluster, generated for a specific rollout if a maintenance window is set. (id: MaintenanceSchedule)
maintenanceUpdatePolicyobjectOptional. The maintenance update policy determines when to allow or deny updates. (id: MaintenanceUpdatePolicy)
migrationSourceobjectOutput only. Cluster created via DMS migration. (id: MigrationSource)
networkstringRequired. The resource link for the VPC network in which cluster resources are created and from which they are accessible via Private IP. The network must belong to the same project as the cluster. It is specified in the form: projects/{project}/global/networks/{network_id}. This is required to create a cluster. Deprecated, use network_config.network instead.
networkConfigobjectMetadata related to network configuration. (id: NetworkConfig)
primaryConfigobjectOutput only. Cross Region replication config specific to PRIMARY cluster. (id: PrimaryConfig)
pscConfigobjectOptional. The configuration for Private Service Connect (PSC) for the cluster. (id: PscConfig)
reconcilingbooleanOutput only. Reconciling (https://google.aip.dev/128#reconciliation). Set to true if the current state of Cluster 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.
satisfiesPzsbooleanOutput only. Reserved for future use.
secondaryConfigobjectCross Region replication config specific to SECONDARY cluster. (id: SecondaryConfig)
sslConfigobjectSSL configuration for this AlloyDB cluster. (id: SslConfig)
statestringOutput only. The current serving state of the cluster.
subscriptionTypestringOptional. Subscription type of the cluster.
tagsobjectOptional. Input only. Immutable. Tag keys/values directly bound to this resource. For example: "123/environment": "production", "123/costCenter": "marketing"
trialMetadataobjectOutput only. Metadata for free trial clusters (id: TrialMetadata)
uidstringOutput 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.
updateTimestring (google-datetime)Output only. Update time stamp

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectprojectsId, locationsId, clustersIdviewGets details of a single Cluster.
listselectprojectsId, locationsIdpageSize, pageToken, filter, orderByLists Clusters in a given project and location.
createinsertprojectsId, locationsIdclusterId, requestId, validateOnlyCreates a new Cluster in a given project and location.
patchupdateprojectsId, locationsId, clustersIdupdateMask, requestId, validateOnly, allowMissingUpdates the parameters of a single Cluster.
deletedeleteprojectsId, locationsId, clustersIdrequestId, etag, validateOnly, forceDeletes a single Cluster.
restore_from_cloud_sqlexecprojectsId, locationsIdRestores an AlloyDB cluster from a CloudSQL resource.
exportexecprojectsId, locationsId, clustersIdExports data from the cluster. Imperative only.
importexecprojectsId, locationsId, clustersIdImports data to the cluster. Imperative only.
upgradeexecprojectsId, locationsId, clustersIdUpgrades a single Cluster. Imperative only.
promoteexecprojectsId, locationsId, clustersIdPromotes a SECONDARY cluster. This turns down replication from the PRIMARY cluster and promotes a secondary cluster into its own standalone cluster. Imperative only.
switchoverexecprojectsId, locationsId, clustersIdSwitches the roles of PRIMARY and SECONDARY clusters without any data loss. This promotes the SECONDARY cluster to PRIMARY and sets up the original PRIMARY cluster to replicate from this newly promoted cluster.
restoreexecprojectsId, locationsIdCreates a new Cluster in a given project and location, with a volume restored from the provided source, either a backup ID or a point-in-time and a source cluster.

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.

NameDatatypeDescription
clustersIdstring
locationsIdstring
projectsIdstring
allowMissingboolean
clusterIdstring
etagstring
filterstring
forceboolean
orderBystring
pageSizeinteger (int32)
pageTokenstring
requestIdstring
updateMaskstring (google-fieldmask)
validateOnlyboolean
viewstring

SELECT examples

Gets details of a single Cluster.

SELECT
name,
annotations,
automatedBackupPolicy,
backupSource,
cloudsqlBackupRunSource,
clusterType,
continuousBackupConfig,
continuousBackupInfo,
createTime,
databaseVersion,
deleteTime,
displayName,
encryptionConfig,
encryptionInfo,
etag,
initialUser,
labels,
maintenanceSchedule,
maintenanceUpdatePolicy,
migrationSource,
network,
networkConfig,
primaryConfig,
pscConfig,
reconciling,
satisfiesPzs,
secondaryConfig,
sslConfig,
state,
subscriptionType,
tags,
trialMetadata,
uid,
updateTime
FROM google.alloydb.clusters
WHERE projectsId = '{{ projectsId }}' -- required
AND locationsId = '{{ locationsId }}' -- required
AND clustersId = '{{ clustersId }}' -- required
AND view = '{{ view }}';

INSERT examples

Creates a new Cluster in a given project and location.

INSERT INTO google.alloydb.clusters (
data__displayName,
data__labels,
data__databaseVersion,
data__networkConfig,
data__network,
data__etag,
data__annotations,
data__initialUser,
data__automatedBackupPolicy,
data__sslConfig,
data__encryptionConfig,
data__continuousBackupConfig,
data__secondaryConfig,
data__pscConfig,
data__maintenanceUpdatePolicy,
data__subscriptionType,
data__tags,
projectsId,
locationsId,
clusterId,
requestId,
validateOnly
)
SELECT
'{{ displayName }}',
'{{ labels }}',
'{{ databaseVersion }}',
'{{ networkConfig }}',
'{{ network }}',
'{{ etag }}',
'{{ annotations }}',
'{{ initialUser }}',
'{{ automatedBackupPolicy }}',
'{{ sslConfig }}',
'{{ encryptionConfig }}',
'{{ continuousBackupConfig }}',
'{{ secondaryConfig }}',
'{{ pscConfig }}',
'{{ maintenanceUpdatePolicy }}',
'{{ subscriptionType }}',
'{{ tags }}',
'{{ projectsId }}',
'{{ locationsId }}',
'{{ clusterId }}',
'{{ requestId }}',
'{{ validateOnly }}'
RETURNING
name,
done,
error,
metadata,
response
;

UPDATE examples

Updates the parameters of a single Cluster.

UPDATE google.alloydb.clusters
SET
data__displayName = '{{ displayName }}',
data__labels = '{{ labels }}',
data__databaseVersion = '{{ databaseVersion }}',
data__networkConfig = '{{ networkConfig }}',
data__network = '{{ network }}',
data__etag = '{{ etag }}',
data__annotations = '{{ annotations }}',
data__initialUser = '{{ initialUser }}',
data__automatedBackupPolicy = '{{ automatedBackupPolicy }}',
data__sslConfig = '{{ sslConfig }}',
data__encryptionConfig = '{{ encryptionConfig }}',
data__continuousBackupConfig = '{{ continuousBackupConfig }}',
data__secondaryConfig = '{{ secondaryConfig }}',
data__pscConfig = '{{ pscConfig }}',
data__maintenanceUpdatePolicy = '{{ maintenanceUpdatePolicy }}',
data__subscriptionType = '{{ subscriptionType }}',
data__tags = '{{ tags }}'
WHERE
projectsId = '{{ projectsId }}' --required
AND locationsId = '{{ locationsId }}' --required
AND clustersId = '{{ clustersId }}' --required
AND updateMask = '{{ updateMask}}'
AND requestId = '{{ requestId}}'
AND validateOnly = {{ validateOnly}}
AND allowMissing = {{ allowMissing}}
RETURNING
name,
done,
error,
metadata,
response;

DELETE examples

Deletes a single Cluster.

DELETE FROM google.alloydb.clusters
WHERE projectsId = '{{ projectsId }}' --required
AND locationsId = '{{ locationsId }}' --required
AND clustersId = '{{ clustersId }}' --required
AND requestId = '{{ requestId }}'
AND etag = '{{ etag }}'
AND validateOnly = '{{ validateOnly }}'
AND force = '{{ force }}';

Lifecycle Methods

Restores an AlloyDB cluster from a CloudSQL resource.

EXEC google.alloydb.clusters.restore_from_cloud_sql 
@projectsId='{{ projectsId }}' --required,
@locationsId='{{ locationsId }}' --required
@@json=
'{
"cloudsqlBackupRunSource": "{{ cloudsqlBackupRunSource }}",
"clusterId": "{{ clusterId }}",
"cluster": "{{ cluster }}"
}';