canonical: https://jentic.com/apis/googleapis.com/alloydb

# Google AlloyDB API

The AlloyDB API is the control plane for AlloyDB for PostgreSQL on Google Cloud - Google's PostgreSQL-compatible managed database service tuned for transactional and analytical workloads. It provisions and manages clusters and primary or read-pool instances, runs failover and switchover, drives backups and exports, and supports cluster restore. Application data access still goes through the standard PostgreSQL wire protocol; this API is for lifecycle and operations.

## For AI agents

Provision, scale, fail over, back up, and restore AlloyDB for PostgreSQL clusters and instances on Google Cloud.

## Scope

Does not run application SQL queries, manage Postgres roles, or handle non-AlloyDB database services - use for AlloyDB cluster and instance lifecycle only.

## Capabilities

- Create an AlloyDB cluster with primary instance and configure machine type and region
- Add or remove read-pool instances to scale read capacity for an existing cluster
- Run a controlled failover or switchover on a cluster to test disaster recovery
- Trigger an on-demand backup of a cluster and restore from a backup or point-in-time
- Export cluster data to Cloud Storage in PostgreSQL dump or CSV format
- List long-running operations in a project and cancel an in-flight one
- Inject faults into a cluster to validate application failure handling

## Use cases

### Provision Production Postgres Infrastructure

Platform teams use the AlloyDB API to spin up production PostgreSQL clusters as part of an environment provisioning pipeline rather than hand-clicking in the Cloud Console. The flow creates a cluster, adds a primary instance, then attaches one or more read-pool instances. The cluster appears as a standard Postgres endpoint that application services connect to with their existing drivers.

Example prompt: POST /v1/projects/{project}/locations/{loc}/clusters with cluster body, then POST /v1/{+parent}/instances with instanceType=PRIMARY, then create READ_POOL instances under the same parent.

### Disaster Recovery Drills

Reliability teams need to prove that an AlloyDB-backed service tolerates failover. The API exposes :failover and :switchover on instances and :injectFault on clusters, so a DR drill can be expressed as a runbook that triggers the failover, watches the long-running operation, and verifies that application traffic recovered. This replaces ad-hoc console clicks during scheduled DR exercises.

Example prompt: POST /v1/{+name}:failover on the primary instance, poll the returned operation under /v1/{+name}/operations until done, and verify the cluster's primary IP rotated.

### Backup, Restore, and Export Pipeline

A backup automation tool can use the AlloyDB API to schedule on-demand backups of every cluster, list backup objects per project, restore from any backup or point-in-time into a new cluster, and export data to Cloud Storage for archival. This lets compliance-driven teams meet RPO/RTO targets without manual operator steps.

Example prompt: Create a backup with POST /v1/{+parent}/backups, then test restore by POSTing /v1/{+parent}/clusters:restore with backupSource pointing at the backup name.

### Agent-Driven Database Operations

An agent integrating AlloyDB through Jentic can express database lifecycle steps as natural-language intents - provision a cluster, add a read pool, take a backup. Jentic isolates the Google Cloud service account and exposes the operation schemas, so an agent stitches a multi-step DR or environment-bootstrap workflow without writing OAuth or LRO polling boilerplate.

Example prompt: Use the Jentic search query 'create an AlloyDB cluster' to discover the operation, then create the cluster, primary instance, and one read-pool instance and report back the connection details.

## Key endpoints

| Method | Path | Description |
| --- | --- | --- |
| GET | /v1/{+name}/locations | List Google Cloud locations available for AlloyDB |
| GET | /v1/{+name}/operations | List long-running operations in a project and location |
| POST | /v1/{+name}:cancel | Cancel a long-running operation |
| POST | /v1/{+name}:export | Export cluster data to Cloud Storage |
| POST | /v1/{+name}:failover | Fail over an instance to its standby |
| POST | /v1/{+name}:injectFault | Inject a fault into a cluster for DR testing |
| POST | /v1/{+name}:import | Import data into a cluster from Cloud Storage |

## Key resources

- **Clusters** — Top-level AlloyDB cluster resource holding primary and read-pool instances
- **Instances** — Primary and read-pool instances under a cluster, with failover and switchover operations
- **Backups** — On-demand and continuous backups, used for restore and point-in-time recovery
- **Operations** — Long-running operations for create, update, failover, restore, and export calls
- **Locations** — Region listings used as parent paths for clusters and operations

## Why Jentic

- **Setup:** Wiring the AlloyDB API by hand means configuring Google OAuth 2.0 from a service account, rotating short-lived access tokens yourself, and pointing lifecycle calls at the alloydb.googleapis.com host. Through Jentic you install once, import the AlloyDB API from the API Directory, store the OAuth credential once, and your agent calls it.
- **Permission scoping:** AlloyDB puts the resource name in the URL path (/v1/{+name}/locations, /v1/{+name}/operations), so a rule can pin your agent to one project or cluster: it can read locations and operations there and nothing else. You choose the operations it may call, so disruptive actions like failover, injectFault, export, or import are not included unless you add them.
- **Credential handling:** Your Google service account credential is stored once, encrypted, by your own Jentic One instance and rotated into short-lived access tokens at execution time. The key never enters the agent's prompt, logs, or context.
- **Discovery method:** Agents search Jentic by intent such as 'create an AlloyDB cluster' or 'fail over an AlloyDB instance', and Jentic returns the matching AlloyDB operation with its input schema so the agent calls the right endpoint without browsing the reference docs.

## Related APIs

- **Cloud SQL Admin API** — Cloud SQL Admin manages MySQL, PostgreSQL, and SQL Server instances; AlloyDB is Google's higher-performance Postgres-only service.
- **Cloud Spanner API** — Spanner is a globally distributed strongly consistent database; AlloyDB is a regional PostgreSQL-compatible service.
- **Cloud Storage API** — Cloud Storage is the destination for AlloyDB exports and the source for imports.

## FAQ

### What authentication does the AlloyDB API use?

OAuth 2.0 with the cloud-platform scope, typically via a Google Cloud service account that has the AlloyDB Admin or Editor role. Jentic stores the service account credential in your Jentic One instance and issues short-lived access tokens to the agent, keeping keys out of agent context.

### Can I run application SQL queries through this API?

No. The AlloyDB API is the control plane only - provisioning, lifecycle, backup, and operations. Application data access uses the standard PostgreSQL wire protocol against the cluster's IP and port with a Postgres driver.

### What are the rate limits for the AlloyDB API?

AlloyDB control-plane operations are governed by the per-project Google Cloud quota for the AlloyDB service. Long-running operations such as create cluster and restore are throttled to a small number of concurrent operations per project; check IAM and Admin, Quotas in the Cloud Console.

### How do I provision an AlloyDB cluster through Jentic?

Search Jentic for 'create an AlloyDB cluster', load the schema for /v1/projects/{project}/locations/{location}/clusters, and execute it. Run pip install jentic and use the async search, load, execute pattern. Then create a primary instance via /v1/{+parent}/instances.

### How do I run a failover for testing?

Call POST /v1/{+name}:failover on the primary instance. The API returns a long-running operation; poll /v1/{+name}/operations until done is true. Use :switchover for planned, lower-impact failover.

### Is AlloyDB free?

AlloyDB is paid: charges are per vCPU-hour for primary and read-pool instances, per GB of storage, and per GB of backup. See AlloyDB pricing in the Google Cloud Console for the current per-region rates.

### Can I limit what my agent is allowed to do with the AlloyDB API?

Yes. Because you run Jentic One yourself, your own rules decide which AlloyDB operations and credentials the agent may use. AlloyDB puts the resource name in the URL path, so you can pin the agent to a single project or cluster and let it only read locations and operations there. You also pick the exact operations it may call, so disruptive actions like failover, injectFault, export, or import stay off unless you explicitly add them.
