DevDocsDev Docs
RDS

AWS RDS

Managed Relational Database Service

Amazon RDS makes it easy to set up, operate, and scale relational databases in the cloud.

Supported Engines

EngineVersionsUse Case
MySQL5.7, 8.0General purpose
PostgreSQL11-16Complex queries, extensions
MariaDB10.4-10.11MySQL alternative
Oracle19c, 21cEnterprise applications
SQL Server2016-2022Windows applications
AuroraMySQL/PostgreSQLHigh performance

Key Concepts

DB Instances

The basic building block - an isolated database environment in the cloud.

Instance Classes

ClassvCPUsMemoryUse Case
db.t3.micro21 GBDevelopment
db.t3.medium24 GBSmall workloads
db.r5.large216 GBProduction
db.r5.xlarge432 GBHigh memory

Storage Types

TypeDescriptionIOPS
gp3General Purpose SSD3,000-16,000
io1/io2Provisioned IOPS SSDUp to 256,000
magneticLegacy HDDVariable

Multi-AZ Deployments

High availability with automatic failover:

Benefits:

  • Automatic failover
  • No data loss
  • Increased durability
  • Maintenance without downtime

Read Replicas

Scale read-heavy workloads:

Features:

  • Up to 5 read replicas per DB
  • Cross-region replication
  • Can be promoted to standalone DB

Parameter Groups

Customize database configuration:

aws rds create-db-parameter-group \
  --db-parameter-group-name my-params \
  --db-parameter-group-family mysql8.0 \
  --description "Custom MySQL parameters"

Common Parameters:

  • max_connections - Maximum concurrent connections
  • innodb_buffer_pool_size - Memory for caching
  • slow_query_log - Enable slow query logging

Security

Encryption at Rest

aws rds create-db-instance \
  --db-instance-identifier mydb \
  --storage-encrypted \
  --kms-key-id alias/my-key

Network Security

  1. VPC - Run in isolated network
  2. Security Groups - Control access
  3. Subnet Groups - Define subnets

Authentication

  • Password - Traditional username/password
  • IAM - Database authentication with IAM
  • Kerberos - Active Directory integration
# Enable IAM authentication
aws rds modify-db-instance \
  --db-instance-identifier mydb \
  --enable-iam-database-authentication

Backups

Automated Backups

aws rds modify-db-instance \
  --db-instance-identifier mydb \
  --backup-retention-period 7 \
  --preferred-backup-window "03:00-04:00"

Manual Snapshots

aws rds create-db-snapshot \
  --db-instance-identifier mydb \
  --db-snapshot-identifier mydb-snapshot

Point-in-Time Recovery

Restore to any second within retention period:

aws rds restore-db-instance-to-point-in-time \
  --source-db-instance-identifier mydb \
  --target-db-instance-identifier mydb-restored \
  --restore-time 2024-01-15T10:30:00Z

Monitoring

CloudWatch Metrics

MetricDescription
CPUUtilizationCPU usage percentage
FreeableMemoryAvailable RAM
ReadIOPSRead operations/second
WriteIOPSWrite operations/second
DatabaseConnectionsActive connections

Enhanced Monitoring

Real-time OS metrics:

aws rds modify-db-instance \
  --db-instance-identifier mydb \
  --monitoring-interval 60 \
  --monitoring-role-arn arn:aws:iam::123456789012:role/rds-monitoring-role

Performance Insights

Analyze database load:

aws rds modify-db-instance \
  --db-instance-identifier mydb \
  --enable-performance-insights \
  --performance-insights-retention-period 7

Best Practices

Performance

  1. Choose appropriate instance class
  2. Use provisioned IOPS for consistent performance
  3. Enable read replicas for read-heavy workloads
  4. Optimize queries and indexes

Security

  1. Use VPC and security groups
  2. Enable encryption at rest
  3. Use SSL/TLS for connections
  4. Rotate credentials regularly

Cost Optimization

  1. Use Reserved Instances for predictable workloads
  2. Right-size instances based on metrics
  3. Delete unused snapshots
  4. Use Aurora Serverless for variable workloads

Consider Aurora for production workloads - it offers better performance, availability, and management features than standard RDS.

Next Steps

On this page