br4zz4:database

Provisions Aurora PostgreSQL Serverless v2 clusters with Terraform and injects connection URLs into Kubernetes secrets.

Updated May 25, 2025
One-click install
npx skills add https://github.com/oporpino/commons --skill br4zz4-database-oporpino
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: br4zz4:database
Source: https://github.com/oporpino/commons/tree/main/ai/shared/skills/br4zz4%3Adatabase
Command: npx skills add https://github.com/oporpino/commons --skill br4zz4-database-oporpino

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Setting up production database infrastructure involves error-prone decisions around VPC placement, writer/reader topology, credential handling, and failover behavior. This Skill encodes a proven reference pattern so Aurora RDS clusters, Kubernetes secrets, and deployments are created correctly the first time. ## Core Features & Use Cases - Terraform reference pattern: Complete HCL templates for an Aurora PostgreSQL 17.4 Serverless v2 cluster, security groups, subnet groups, and a kubernetes_secret holding generated DATABASE_URL_READONLY and DATABASE_URL_FULLACCESS values. - Operational rules: Hard-won guidance on VPC selection, random instance naming, writer pinning via failover, public/private subnet separation, read-only role grants across schemas, and Looker Studio SSL configuration. - Use Case: When adding a database to a new Rails service, apply the database.tf and secrets.tf pattern, store only the master password in ward, and let the k8s deployment consume credentials from the generated secret. ## Quick Start Ask the AI to create the database infrastructure for a new app following the br4zz4 database pattern with Terraform and Kubernetes secrets.

Frequently Asked Questions about br4zz4:database

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I create an Aurora Serverless v2 cluster with Terraform?▼

Define an aws_rds_cluster with engine aurora-postgresql, engine_mode provisioned, and a serverlessv2_scaling_configuration block, plus an aws_rds_cluster_instance using the db.serverless instance class. Add a security group restricting port 5432 to the VPC CIDR and a DB subnet group.

How should database credentials reach Kubernetes pods?▼

Terraform constructs DATABASE_URL_READONLY and DATABASE_URL_FULLACCESS from RDS outputs and stores them in a kubernetes_secret. Deployments reference the secret via secretKeyRef; credentials are never stored in ward or passed as plain environment variables.

Can I change the VPC of an existing RDS cluster?▼

No, the VPC is fixed at creation because a DB subnet group belongs to exactly one VPC. Moving requires snapshotting, recreating the cluster in the new VPC with snapshot_identifier, and removing the old resources from Terraform state.

Why does my public Aurora reader time out from the internet?▼

The DB subnet group likely mixes public and private subnets, so the publicly_accessible reader landed in a private subnet without an IGW route. Use a public-only subnet group and control exposure per instance with publicly_accessible.

Does promotion_tier choose the Aurora writer instance?▼

No, promotion_tier only governs automatic failover order, not the initial writer selection. Pin the writer with a null_resource running aws rds failover-db-cluster targeting the private instance, and poll until it converges.

Why does DROP ROLE fail on Aurora PostgreSQL?▼

The Aurora master user is rds_superuser, not a true superuser, so it must be a member of a role before dropping it. Run GRANT role TO postgres, then REASSIGN OWNED, DROP OWNED, and DROP ROLE in one guarded DO block.