AWS RDS ও Database Services

লেসন ৩২ / ৩৮

🗄️ RDS = Managed DB

  • MySQL, PostgreSQL, MariaDB, Oracle, SQL Server, Aurora
  • Auto backup, patch, failover
  • Encryption at rest (KMS)

📊 vs Self-managed

Self-managed: cheap, backup/patch = your job
RDS: hands-off, 1.5-2x cost, PITR, Multi-AZ

🚀 Create RDS

1. Engine: PostgreSQL 16
2. db.t3.micro (free tier)
3. 20GB gp3
4. Multi-AZ: yes (prod)
5. Public access: NO 🔥
6. SG: allow only app EC2 SG
7. Backup retention: 7 days
8. Encryption on

🔌 Connect

psql -h myapp.xxxxx.rds.amazonaws.com -U postgres -d myapp

# App env
DB_HOST=myapp.xxxxx.rds.amazonaws.com

🏗️ Multi-AZ

Primary (AZ-a) ↔ sync ↔ Standby (AZ-b)
Failure → auto failover 60-120s
2x cost, production HA

📚 Read Replica

Primary → async → Replica 1,2,3 (read-only)
80% read traffic → replicas
Cross-region replica for DR

💾 Backup

Automated: daily + tx log → PITR any second
Manual snapshot: until deleted
Restore = new instance

🚀 Aurora

  • 5x MySQL, 3x PG performance
  • 10GB → 128TB auto storage
  • 6 copies × 3 AZ
  • Aurora Serverless — pay-per-use
  • Global — cross-region <1s

🦖 DynamoDB

Key-value + document
Single-digit ms latency
Pay per request OR provisioned
Use: session, user, leaderboard

aws dynamodb create-table \
  --table-name Users \
  --attribute-definitions AttributeName=id,AttributeType=S \
  --key-schema AttributeName=id,KeyType=HASH \
  --billing-mode PAY_PER_REQUEST

💡 Service Choice

Relational:      RDS
High scale rel:  Aurora
Key-value:       DynamoDB
Cache:           ElastiCache
Search:          OpenSearch
Analytics:       Redshift

🎓 মূল কথা ⭐

Multi-AZ production mandatory। Public access NO। Aurora 5x perf worth +20% cost। DynamoDB infinite scale, data model think-first।