Skip to main content

Database

Database​

Declares a managed database instance and its logical databases.

Set one engine, AlloyDB (PostgreSQL) or Cloud Spanner, in the engine oneof. Applications reference the logical databases by name.

PropertyTypeDescription
apiVersionstringAPI schema version. Must be lowops.manifests.v1.
kindstringResource kind. Must be Database.
metadatamapThe engine reads the reserved keys name and project to resolve this manifest and its parent Project.
specSpecDesired configuration. See Spec.

Spec​

User-authored database configuration.

The engine, its size and the logical databases to create.

PropertyTypeDescription
descriptionstringOptional free text. The engine copies it to auxiliary resources. AI assistants use it as context.
databaseslist of DatabaseDefinitionLogical databases to create. Applications reference them by name in accessControl.database.schema. See DatabaseDefinition.
alloydbAlloyDBConfigAlloyDB (PostgreSQL) engine configuration. See AlloyDBConfig.
spannerSpannerConfigCloud Spanner engine configuration. See SpannerConfig.

AlloyDBConfig​

AlloyDB (PostgreSQL) engine configuration.

It provisions an AlloyDB cluster with Private Service Connect, a primary instance, optional read-pool instances, and the databases, roles and grants.

PropertyTypeDescription
cpuCountint64vCPUs for each primary and read-pool instance. Must be at least 1.
clusterSizeint64Total instances in the cluster. Must be at least 1. A value of 1 means one primary and no read replicas. Values above 1 add that many read-pool instances.
configurationConfigurationAdvanced PostgreSQL tuning. NOT YET IMPLEMENTED. The engine ignores it. See Configuration.
backupConfigBackupConfigAutomated backup policy. The engine validates and normalizes it but does not yet provision it. See BackupConfig.

BackupConfig​

Automated backup policy for the AlloyDB cluster.

PARTIALLY IMPLEMENTED. The engine validates these fields but does not yet provision a backup policy.

PropertyTypeDescription
enabledboolIf true, validation requires one retention strategy and checks the window ranges. It only gates validation, because the engine does not yet provision the policy.
timeBasedRetentionSecint64Seconds to retain automated backups. Mutually exclusive with quantity_based_retention. Set one of the two if enabled is true.
quantityBasedRetentionint64Number of automated backups to retain. Mutually exclusive with time_based_retention_sec. Set one of the two if enabled is true.
windowDurationstringNOT YET IMPLEMENTED. The engine ignores this field. It will bound the daily backup window, for example 3600s.
daysOfWeeklist of stringWeekdays on which backups can run, for example MONDAY. Default: ["SUNDAY"]. The engine does not use it yet.
hoursint64Start hour of the backup window (0-23, UTC). If you enable backups, validation checks the range.
minutesint64Start minute of the backup window (0-59). If you enable backups, validation checks the range.

Configuration​

Advanced PostgreSQL tuning parameters.

NOT YET IMPLEMENTED. The engine ignores these fields. They will set AlloyDB database flags.

PropertyTypeDescription
maxConnectionsint64Will set the PostgreSQL max_connections flag. Must be at least 1000.
autoExplainboolIf true, will enable auto_explain to log plans of slow queries.
googleColumnarEngineboolIf true, will enable the AlloyDB columnar engine.
googleDbAdvisorboolIf true, will enable the AlloyDB Index Advisor.

DatabaseDefinition​

A logical database to provision on the instance.

Applications reference it by name in accessControl.database.schema. AlloyDB creates a PostgreSQL database with read/write group roles. Spanner creates a Spanner database.

PropertyTypeDescription
namestringDatabase name, for example team_1. Required. For Spanner: 2-30 characters, lowercase letters, digits, - or _, and a letter first.
extensionslist of stringPostgreSQL extensions to enable, for example uuid-ossp. AlloyDB only: validation rejects extensions on Spanner databases.

SpannerConfig​

Cloud Spanner engine configuration.

It provisions a regional Spanner instance with fixed capacity or autoscaling, and IAM-based access. It needs no VPC or proxy.

PropertyTypeDescription
processingUnitsint64Fixed capacity in processing units (PU), from 100 to 9999, in multiples of 100. Mutually exclusive with autoscaling. If you set neither, the default is 100 PU.
autoscalingboolIf true, Spanner manages the capacity and the engine ignores processing_units. Mutually exclusive with fixed capacity below 1000 PU.
regionstringGCP region of the instance, for example us-east1. If omitted, it comes from the parent Project. The instance config is regional-{region}.
editionstringSpanner edition: STANDARD, ENTERPRISE or ENTERPRISE_PLUS. Default: STANDARD. Validation rejects any other value.