RDS Setup & Instance Types
RDS Setup & Instance Types Amazon RDS manages relational database infrastructure — provisioning, patching, backups, and scaling. Choosing the right engine, inst…
RDS Setup & Instance Types
Amazon RDS manages relational database infrastructure — provisioning, patching, backups, and scaling. Choosing the right engine, instance class, storage type, and deployment mode affects cost, performance, and availability.
Supported Engines & Instance Classes
# Supported engines:
# MySQL 8.0 — popular open source; good general-purpose choice
# PostgreSQL 16 — most feature-rich open source; JSON, extensions, PL/pgSQL
# MariaDB 10.x — MySQL fork; XtraDB storage engine
# Oracle — Enterprise-only features; bring your own license or license-included
# SQL Server — Windows/.NET stacks; Express/Standard/Enterprise editions
# Aurora MySQL — MySQL-compatible; up to 5x faster than MySQL; serverless option
# Aurora PostgreSQL — PG-compatible; up to 3x faster than PostgreSQL; Global Database
# Instance class families:
# db.t3/db.t4g — burstable; cheapest; for dev/test or low-traffic
# db.m5/db.m6i/db.m7g — general purpose; balanced CPU/memory; good baseline
# db.r5/db.r6i/db.r7g — memory optimized; for large databases, in-memory caches
# db.x2g/db.x1e — extreme memory; SAP HANA, large OLAP
# *g suffix = Graviton (ARM) — ~20% better price/performance than Intel equivalent
# Create a PostgreSQL RDS instance
aws rds create-db-instance \
--db-instance-identifier myapp-prod-db \
--db-instance-class db.m6g.large \
--engine postgres \
--engine-version 16.1 \
--master-username dbadmin \
--master-user-password "$(openssl rand -base64 20)" \
--allocated-storage 100 \
--storage-type gp3 \
--storage-encrypted \
--multi-az \
--db-subnet-group-name myapp-db-subnet-group \
--vpc-security-group-ids sg-0db123 \
--backup-retention-period 14 \
--no-publicly-accessible \
--tags "Key=Env,Value=prod"
# Wait for instance to be available
aws rds wait db-instance-available --db-instance-identifier myapp-prod-db
# Describe instance
aws rds describe-db-instances \
--db-instance-identifier myapp-prod-db \
--query "DBInstances[0].{Endpoint:Endpoint.Address,Port:Endpoint.Port,Status:DBInstanceStatus}"Storage Types & Parameter Groups
# Storage types:
# gp2 — General Purpose SSD; 3 IOPS/GB baseline; burst to 3000 IOPS; being replaced by gp3
# gp3 — General Purpose SSD v2; 3000 IOPS baseline (decoupled from storage size); 125 MiB/s
# upgrade gp2 → gp3 for ~20% cost savings with same or better performance
# io1/io2 — Provisioned IOPS; for latency-sensitive workloads; up to 256k IOPS (io2 Block Express)
# magnetic — legacy; avoid for new deployments
# Modify storage type and IOPS (no downtime for gp2→gp3)
aws rds modify-db-instance \
--db-instance-identifier myapp-prod-db \
--storage-type gp3 \
--iops 6000 \
--storage-throughput 250 \
--apply-immediately
# DB Subnet Group — tells RDS which subnets it can use (must span ≥2 AZs for Multi-AZ)
aws rds create-db-subnet-group \
--db-subnet-group-name myapp-db-subnet-group \
--db-subnet-group-description "RDS subnets for myapp" \
--subnet-ids subnet-private-aaa111 subnet-private-bbb222 subnet-private-ccc333
# Parameter Groups — tune database engine settings without SSH access
# Each engine+version has its own family (e.g. postgres16, mysql8.0)
aws rds create-db-parameter-group \
--db-parameter-group-name myapp-postgres16-params \
--db-parameter-group-family postgres16 \
--description "Custom params for myapp"
# Modify a parameter
aws rds modify-db-parameter-group \
--db-parameter-group-name myapp-postgres16-params \
--parameters "ParameterName=max_connections,ParameterValue=500,ApplyMethod=pending-reboot" \
"ParameterName=shared_buffers,ParameterValue={DBInstanceClassMemory/4},ApplyMethod=pending-reboot" \
"ParameterName=log_min_duration_statement,ParameterValue=1000,ApplyMethod=immediate"
# Apply parameter group to instance
aws rds modify-db-instance \
--db-instance-identifier myapp-prod-db \
--db-parameter-group-name myapp-postgres16-params