gcp-alloydb
Installation
Review the source and dependencies with a prompt. A package is available to download.
Install with an AI assistant
Copy the prompt so your assistant can review the pinned revision and dependencies first.
View promptHide prompt
Check whether SkillPI Skill Finder is installed for your current agent. If it is missing, install and enable it using the official instructions at https://github.com/Findskills/skillpi. Then use Skill Finder to locate and install "gcp-alloydb" from this exact SkillPI detail page: https://skillpi.com/skills/deepskill-893064b6b008e0a899adc44bbeaec0da93b20fb5852f0412733b6d443fc80b5f. Verify the upstream source and version against https://github.com/TerminalSkills/skills before installing. If they do not match, stop and report the mismatch. Report the installed path and source version.
Source and setup
github.com
Setup guidance pending
See the original source for supported tools, dependencies, and permissions.
Installation test pending
Guidance and tools for configuring and managing AlloyDB for PostgreSQL on Google Cloud. Describes deployment aspects of this PostgreSQL-compatible managed database, including compute/storage separation, columnar engine, AlloyDB AI capabilities, vector search, and natural language queries. Intended for high-availability clusters, read replica pools, IAM database authentication, and Terraform-managed deployments.
Introduction source: third_party · TerminalSkills · 1.0.0 Reference
SkillPi interpretation
- Tasks
- AlloyDB is Google Cloud's managed PostgreSQL-compatible database. It separates compute and storage so they scale independently, runs an analytics-grade columnar engine alongside the transactional rows, and ships with AlloyDB AI — vector search, hybrid search, and model-endpoint management for building RAG and semantic-search apps directly against the database.
- Software, accounts and paid services
- ```bash
- Testing
- Not tested
Browse files
Frontmatter
name: gcp-alloydb
description: |
Provision and manage AlloyDB for PostgreSQL clusters and instances on Google
Cloud — a managed, PostgreSQL-compatible database with disaggregated
compute/storage, columnar engine, and AlloyDB AI for vector search and
natural-language queries. Use for HA clusters, read pools, IAM database auth,
and Terraform-managed AlloyDB deployments.
license: Apache-2.0
compatibility: 'gcloud-cli, terraform, psql, AlloyDB Auth Proxy'
metadata:
author: google-cloud
version: 1.0.0
category: devops
tags:
- gcp
- alloydb
- postgres
- database
- vector-searchGCP AlloyDB
Overview
AlloyDB is Google Cloud's managed PostgreSQL-compatible database. It separates compute and storage so they scale independently, runs an analytics-grade columnar engine alongside the transactional rows, and ships with AlloyDB AI — vector search, hybrid search, and model-endpoint management for building RAG and semantic-search apps directly against the database.
Instructions
Core Concepts
- Cluster — the top-level resource that owns storage, backups, and configuration shared across instances
- Primary instance — the read/write instance; one per cluster
- Read pool instance — horizontally scalable read replicas backed by the same storage
- Secondary cluster — cross-region replica for DR
- Continuous backup — point-in-time recovery within the recovery window (default 14 days)
- AlloyDB AI — native
vectorextension,google_ml_integrationfor inference, hybrid search
Prerequisites
# Enable APIs
gcloud services enable alloydb.googleapis.com \
servicenetworking.googleapis.com \
compute.googleapis.com
# Reserve a private IP range for VPC peering (one-time per VPC)
gcloud compute addresses create alloydb-peering \
--global --purpose=VPC_PEERING --prefix-length=16 \
--network=default
gcloud services vpc-peerings connect \
--service=servicenetworking.googleapis.com \
--ranges=alloydb-peering --network=default
Creating a Cluster and Primary Instance
# Create a cluster (storage + config; no compute yet)
gcloud alloydb clusters create prod-cluster \
--region=us-central1 \
--network=default \
--password="$(openssl rand -base64 24)" \
--automated-backup-days-of-week=MONDAY,THURSDAY \
--automated-backup-start-times=02:00 \
--automated-backup-retention-count=14
# Create the primary instance (the actual compute)
gcloud alloydb instances create prod-primary \
--cluster=prod-cluster \
--region=us-central1 \
--instance-type=PRIMARY \
--cpu-count=4 \
--availability-type=REGIONAL \
--database-flags="cloudsql.iam_authentication=on,alloydb.enable_pgvector=on"
For production, prefer IAM database authentication over password auth — it removes static credentials entirely and integrates with service accounts.
Read Pool for Scaling Reads
# Add a read pool (e.g., for analytics or reporting traffic)
gcloud alloydb instances create reports-pool \
--cluster=prod-cluster \
--region=us-central1 \
--instance-type=READ_POOL \
--read-pool-node-count=3 \
--cpu-count=4
Connecting from an Application
# Run the Auth Proxy locally (handles IAM + TLS)
./alloydb-auth-proxy \
projects/my-project/locations/us-central1/clusters/prod-cluster/instances/prod-primary \
--port 5432
# Python connection using the AlloyDB connector + IAM auth
from google.cloud.alloydb.connector import Connector, IPTypes
import sqlalchemy
connector = Connector()
def getconn():
return connector.connect(
"projects/my-project/locations/us-central1/clusters/prod-cluster/instances/prod-primary",
"pg8000",
user="app-sa@my-project.iam",
db="orders",
enable_iam_auth=True,
ip_type=IPTypes.PRIVATE,
)
engine = sqlalchemy.create_engine("postgresql+pg8000://", creator=getconn)
with engine.connect() as conn:
result = conn.execute(sqlalchemy.text("SELECT current_database(), version()"))
print(result.fetchone())
AlloyDB AI — Vector Search
-- Enable extensions (once per database, run as superuser)
CREATE EXTENSION IF NOT EXISTS vector;
CREATE EXTENSION IF NOT EXISTS google_ml_integration;
-- Schema with embeddings
CREATE TABLE products (
id BIGSERIAL PRIMARY KEY,
name TEXT NOT NULL,
description TEXT,
embedding vector(768)
);
-- Generate embeddings inline using a registered model endpoint
UPDATE products
SET embedding = embedding('textembedding-gecko@003', description)
WHERE embedding IS NULL;
-- ScaNN index for fast approximate nearest-neighbor search
CREATE INDEX ON products USING scann (embedding cosine)
WITH (num_leaves = 100);
-- Hybrid search: semantic + lexical
SELECT id, name, description,
1 - (embedding <=> embedding('textembedding-gecko@003', 'wireless headphones with noise cancellation')) AS similarity
FROM products
WHERE description ILIKE '%bluetooth%'
ORDER BY embedding <=> embedding('textembedding-gecko@003', 'wireless headphones with noise cancellation')
LIMIT 10;
Cross-Region DR with Secondary Cluster
# Promote a secondary cluster in a different region
gcloud alloydb clusters create-secondary dr-cluster \
--region=us-east1 \
--primary-cluster=projects/my-project/locations/us-central1/clusters/prod-cluster \
--network=default
# Failover (promote secondary to standalone primary)
gcloud alloydb clusters promote dr-cluster --region=us-east1
Terraform
resource "google_alloydb_cluster" "prod" {
cluster_id = "prod-cluster"
location = "us-central1"
network_config {
network = data.google_compute_network.default.id
}
initial_user {
user = "postgres"
password = var.alloydb_password
}
automated_backup_policy {
location = "us-central1"
backup_window = "1800s"
enabled = true
weekly_schedule {
days_of_week = ["MONDAY", "THURSDAY"]
start_times { hours = 2 }
}
quantity_based_retention { count = 14 }
}
}
resource "google_alloydb_instance" "primary" {
cluster = google_alloydb_cluster.prod.name
instance_id = "prod-primary"
instance_type = "PRIMARY"
machine_config { cpu_count = 4 }
availability_type = "REGIONAL"
database_flags = {
"alloydb.enable_pgvector" = "on"
"cloudsql.iam_authentication" = "on"
}
}
Examples
Example 1 — Set up a production cluster with read replicas
User asks for a production-ready AlloyDB deployment. Create the cluster with regional availability, configure automated backups with 14-day retention, provision a primary instance with IAM auth enabled, then add a 3-node read pool sized for the analytics workload. Hand the user the Auth Proxy connection string and a Terraform module they can commit.
Example 2 — Add semantic search to an existing PostgreSQL app
User has a products table on AlloyDB and wants vector search. Enable vector and google_ml_integration extensions, add an embedding vector(768) column, backfill embeddings using embedding('textembedding-gecko@003', description), create a ScaNN index, and rewrite the search endpoint to combine cosine distance with existing WHERE filters for hybrid retrieval.
Guidelines
- Use IAM database authentication in production — service accounts authenticate to the database without storing passwords
- Set
availability-type=REGIONALfor HA;ZONALonly for dev/test - Keep the Auth Proxy in your container or sidecar — never expose AlloyDB to the public internet
- Read pools are the right scaling lever before considering bigger primary CPUs
- For vector workloads, ScaNN indexes outperform
ivfflatandhnswat scale; tunenum_leavesto ~sqrt(rows) - Use secondary clusters for DR; failover is manual but typically completes in minutes
- Continuous backup gives PITR within the recovery window — separate from automated backups (which are snapshot-based)
- Monitor slow queries via Query Insights (built into the AlloyDB console)
Current listing version
1.0.0
Quality assessment
Out of 100 · Assessment report from SkillPi LAB.
Highlights
- 提供完整的 AlloyDB 生产级部署方案,涵盖集群、实例、灾备和自动化
- 集成向量搜索与 AlloyDB AI,支持 RAG 和语义搜索应用场景
- 面向 DevOps 和数据库开发者的高频刚需工具
Highlights
- 触发描述完整覆盖多种变体(HA 集群、只读副本、IAM 认证、Terraform 部署)
- 边界清晰,无歧义或重叠风险
Highlights
- 文档结构清晰,分步骤指导,包含端到端示例和最佳实践
- frontmatter 完整,单文件长度合理
Highlights
- 所有命令基于官方 gcloud CLI 和 Terraform,参数正确
- 涵盖主要异常处理与不可逆操作确认机制
- 工具来源明确,执行流程可靠
The arithmetic mean of the first four original scores, rounded to a whole number.
Static text checks
100 / 100 · skillpi-20261123-no-r3-v1
No current rules matched the text.
This score reflects rule matches in the text and is provided for reference before use. It excludes attachments and runtime behavior.
Permissions and checks before use
Automatically summarized from this main document. Matches may be examples or defensive advice; they are not actual permission declarations. Attachments, external dependencies and runtime behavior are not covered.
-
Accounts, secrets or authorization
Use a dedicated least-privilege account. Keep secrets out of public content and command logs; verify the receiving service and tenant.
Mentioned in main document · lines 82 -
Cloud changes and possible charges
Preview changes and verify account, region, permissions and costs. Confirm creation, deployment or deletion separately.
Mentioned in main document · lines 49, 62, 73, 88, 166
Security rating and access scope
safe · Static evidence review; not a runtime safety guarantee.
```bash
Before use, confirm and authorize actual file access, external services and network destinations in your host. This review grants no runtime permissions.
User discussion
No verified reviews yet.