tech/aws/database

DATABASE

AWS managed databases — RDS (PostgreSQL/MySQL), DynamoDB, Aurora, ElastiCache (Redis).

production
requires: tech/aws
improves: tech/aws

AWS Database

Stub — full skill pending. Core patterns documented below.

Services

ServiceTypeUse case
RDS PostgreSQLRelationalGeneral purpose; preferred over MySQL for new projects
RDS MySQLRelationalRequired for Frappe/ERPNext
Aurora Serverless v2RelationalAuto-scales; good for variable load; PostgreSQL-compatible
DynamoDBNoSQL key-valueHigh-throughput event storage, session store, leaderboards
ElastiCache RedisIn-memorySession cache, queue, rate limiting, pub/sub

RDS essentials

# Create RDS PostgreSQL instance
aws rds create-db-instance \
  --db-instance-identifier mydb \
  --db-instance-class db.t3.micro \
  --engine postgres \
  --engine-version 16.2 \
  --master-username admin \
  --master-user-password $(aws secretsmanager get-secret-value --secret-id db-password --query SecretString --output text) \
  --allocated-storage 20 \
  --vpc-security-group-ids sg-xxxxxxxx \
  --db-subnet-group-name my-subnet-group \
  --backup-retention-period 7 \
  --no-publicly-accessible \
  --region af-south-1

Connection from Lambda/ECS

Use AWS Secrets Manager to store DB credentials. Retrieve in application code — never hardcode.

For Lambda with RDS: consider RDS Proxy to pool connections (Lambda can exhaust DB connections under load — RDS Proxy prevents this).