Overview
The RDS Aurora resource provides a fully managed, highly available PostgreSQL database cluster using Aurora Serverless v2. It includes automatic scaling, built-in RDS Proxy for connection pooling, Performance Insights for monitoring, and integrated AWS Secrets Manager for credential management with automatic rotation. RDS Aurora is ideal for:- Production applications requiring high availability
- Workloads with variable or unpredictable traffic patterns
- Applications needing automatic scaling without downtime
- Multi-region disaster recovery setups
- Microservices architectures requiring connection pooling
- Aurora Serverless v2 with 1 writer and 2 reader instances
- Built-in RDS Proxy for connection pooling and failover
- Automatic credential rotation every 30 days via Secrets Manager
- Performance Insights with 7-day retention
- Customer-managed KMS encryption for storage and monitoring data
- 14-day backup retention with automated backups
Resource Class
Basic Usage
Configuration Options
Core Properties
| Property | Type | Description | Default |
|---|---|---|---|
vpc | IVpc | VPC for database deployment (required) | - |
databaseName | string | Database name | "postgres" |
engine | DatabaseClusterEngine | Aurora engine version | Aurora PostgreSQL 15.6 |
clusterIdentifier | string | Cluster identifier | - |
port | number | Database port | 5432 |
Backup Configuration
| Property | Type | Description | Default |
|---|---|---|---|
backup | BackupProps | Backup retention days | { retention: 14 } |
Capacity Configuration
| Property | Type | Description | Default |
|---|---|---|---|
writer | ServerlessV2ScalingConfiguration | Writer instance scaling | { minCapacity: 0.5, maxCapacity: 2 } |
readers | ServerlessV2ScalingConfiguration[] | Reader instances scaling | 2 readers with default scaling |
Monitoring Configuration
| Property | Type | Description | Default |
|---|---|---|---|
monitoringInterval | Duration | Enhanced monitoring interval | Duration.minutes(1) |
preferredMaintenanceWindow | string | Maintenance window | "sat:12:30-sat:20:30" |
Default Configuration
The RDS Aurora construct includes these defaults:- 1 writer instance (Aurora Serverless v2, 0.5-2 ACU capacity)
- 2 reader instances (Aurora Serverless v2, 0.5-2 ACU capacity each)
- Aurora PostgreSQL 15.6 engine
- RDS Proxy with 50% max connections, 5-minute idle timeout
- Performance Insights enabled with 7-day retention
- Customer-managed KMS keys (4 total: storage + 3 for insights)
- Auto-rotating credentials every 30 days
- 14-day backup retention
- Enhanced monitoring every 1 minute
Architecture Overview
Multi-AZ High Availability
Built-in Components
The Aurora cluster automatically provisions:- Database Cluster: Aurora Serverless v2 cluster
- Writer Instance: Primary database instance
- Reader Instances: 2 read replicas for scaling
- RDS Proxy: Connection pooling and failover handling
- Secrets Manager Secret: PostgreSQL credentials
- KMS Keys: 4 customer-managed keys for encryption
- Performance Insights: Monitoring and query analysis
- Security Group: Database network access control
Usage Patterns
Pattern 1: Development Environment
Pattern 2: Production with High Scaling
Pattern 3: Custom Maintenance Window
Integration Examples
With ECS Services
With Lambda Functions
With Application Load Balancer
Security Configuration
Network Isolation
Connection Security
Encryption at Rest
IAM Authentication
RDS Proxy Configuration
Understanding RDS Proxy
The built-in RDS Proxy provides:- Connection pooling: Reduces database connection overhead
- Automatic failover: Faster recovery during failures
- IAM authentication: Token-based access
- Connection limits: 50% of max connections by default
Proxy Benefits
Cost Optimization
Scaling Strategy
Backup Optimization
Monitoring Optimization
Performance Tuning
Read Scaling
Write Scaling
Connection Management
Methods
getHostEndpoint()
getHostPort()
getCredentials()
Complete Example
Best Practices
- Always use RDS Proxy endpoint for application connections - provides connection pooling and faster failover
- Deploy in private subnets (PRIVATE_ISOLATED) - never expose databases publicly
- Use Secrets Manager integration - avoid hardcoded credentials, leverage automatic rotation
- Enable Performance Insights - included by default, essential for query optimization
- Set appropriate scaling limits - balance performance needs with cost controls
- Configure maintenance windows - schedule during low-traffic periods
- Monitor with CloudWatch - set alarms for CPU, connections, and replication lag
- Use reader endpoints for read-heavy queries - distribute load across replicas
- Implement connection pooling in applications - even with RDS Proxy
- Test failover scenarios - verify application handles primary instance failures
Common Patterns
Multi-Environment Setup
Read Replica for Analytics
Blue/Green Deployments
Cost Considerations
| Component | Cost | Optimization |
|---|---|---|
| Aurora Serverless v2 | $0.12/ACU-hour | Set minCapacity to 0.5, cap maxCapacity |
| RDS Proxy | 0.0000055/connection | Included automatically, reduces DB connections |
| Backup Storage | $0.095/GB-month (beyond DB size) | Reduce retention period for non-critical data |
| Performance Insights | Free (7-day retention) | Extended retention adds cost |
| Data Transfer | $0.01-0.09/GB | Use VPC endpoints, minimize cross-AZ traffic |
| KMS Keys | $1/month per key | 4 keys created automatically ($4/month) |
- Development: ~$50-100 (0.5-1 ACU minimum)
- Production: ~$200-500 (2-4 ACU baseline, scales up)
- Enterprise: ~$1000+ (high minimum capacity, multiple regions)
Troubleshooting
Common Issues
-
Connection timeouts
- Cause: Security group not configured, wrong endpoint used
- Solution: Verify security group allows traffic on port 5432, use proxy endpoint not cluster endpoint
-
Authentication failures
- Cause: Using outdated credentials, rotation in progress
- Solution: Always fetch credentials from Secrets Manager at runtime, implement retry logic for rotation period
-
High scaling costs
- Cause: maxCapacity set too high, constant high load
- Solution: Lower maxCapacity, optimize queries, add read replicas for read-heavy workloads
-
Slow query performance
- Cause: Missing indexes, inefficient queries, insufficient capacity
- Solution: Use Performance Insights to identify slow queries, add indexes, increase minCapacity
-
RDS Proxy connection errors
- Cause: Proxy connection limits exceeded
- Solution: Increase application connection pool efficiency, reduce connection churn
Debug Commands
Performance Insights Queries
Related Resources
- RDS Instance - Standard RDS instance for predictable workloads
- RDS Free Tier - Free tier eligible RDS for development
- VPC - Network configuration for database deployment
- Security Group - Network access controls
- Secrets Manager - Credential management
- ECS Cluster - Container orchestration for application tier
- Lambda Function - Serverless compute integration