Overview
TheRdsInstance construct provisions a managed PostgreSQL database instance with Multi-AZ deployment, encryption, automated backups, and optional read replicas. It suits applications that want predictable performance and cost.
Resource Class
Basic Usage
instanceType takes the bare class.size form (t4g.medium, r6g.large), not the db.-prefixed form. The construct passes the value straight to new InstanceType(...), so a db. prefix produces an invalid instance class.Configuration Options
Core Properties
Engine Configuration
Instance Configuration
When Fjall provisions a database through an application tier, the instance type defaults vary:
t4g.micro (Tinkerer), t4g.small (Lightweight), t4g.large (Standard), r7g.large (Resilient), r6g.xlarge (Enterprise). When using the construct directly, set instanceType explicitly.Backup and Maintenance
Snapshot Restore
Additional Features
Restoring from Snapshot
Create a new database from an existing RDS snapshot:This password reset only applies to restores performed through infrastructure code (
snapshotIdentifier). Restores performed through AWS Backup (fjall restore rds) run outside CloudFormation and keep the snapshot-era password — see fjall restore.Instance Types
General Purpose (Burstable)
General Purpose (Standard)
Memory Optimised
Storage Configuration
Auto-scaling Storage
Storage Type
All instances use GP3 storage by default:- Baseline: 3,000 IOPS
- Burst: up to 16,000 IOPS
- Throughput: 125 MiB/s baseline
Security Features
Encryption
Storage encryption is on by default with a customer-managed KMS key. Performance Insights data is encrypted when Database Insights is enabled.Network Security
High Availability
Multi-AZ Deployment
Multi-AZ is enabled by default. SetmultiAz: false to opt out.
- Automatic failover (1-2 minutes)
- Synchronous replication
- Maintenance without downtime
- Enhanced durability
RDS Proxy
Enable connection pooling by passing aProxyConfig object. ProxyConfig fields: requireTLS, maxConnections, maxIdleConnections, connectionBorrowTimeout, vpcSubnets.
- Reduced database connections
- Improved application scalability
- Automatic failover handling
- IAM authentication support
Read Replicas
Enable a read replica by passing aReadReplicaConfig object. ReadReplicaConfig fields: instanceType, availabilityZone. Pass {} to inherit the primary’s instance type.
- Asynchronous replication
- Read-only queries
- Can be promoted to primary
- Cross-region support
Database Insights
Database Insights (formerly Performance Insights) is enabled by default. Pass aDatabaseInsightsConfig object to set the mode, or false to disable it. DatabaseInsightsConfig fields: mode ("standard" or "advanced"), encryptionKey.
- SQL-level performance metrics
- 7 days retention in standard mode, 15 months in advanced mode
- Top SQL identification
- Wait event analysis
Backup and Recovery
Custom Backup Configuration
Automated Backups
- Daily automated backups
- Point-in-time recovery
- Transaction log backups every 5 minutes
- Backups retained after deletion
Methods
Get Host Endpoint
Get Host Port
Get Credentials
Get Connections
Get Security Group
Complete Example
Cost Optimisation
Instance Sizing
*Estimates for us-east-1, Multi-AZ deployment.
Cost Saving Tips
- Use Graviton instances (t4g, r6g, m6g) for up to 20% savings.
- Reserved Instances for 1-3 year commitments.
- Right-size based on CloudWatch metrics.
- Consider Aurora for variable workloads.
- Optimise storage size to avoid over-provisioning.
Best Practices
- Keep Multi-AZ on for production (default).
- Use memory-optimised instance types (r6g) for production.
- Monitor storage usage and keep autoscaling on.
- Test backups regularly.
- Keep encryption on (default).
- Set up CloudWatch alarms for key metrics.
Limitations
- Maximum 64 TB storage.
- Maximum 40,000 IOPS (GP3).
- No automatic cross-region failover.
- Read replicas have replication lag.
- Maintenance windows cause brief downtime.
Next Steps
RDS Free Tier
Run a free-tier-eligible PostgreSQL instance during your first 12 months.
RDS Aurora
Scale to an Aurora cluster with serverless and global options.
Storage Factory
Provision databases and storage through the Fjall factory pattern.
Secrets Manager
Manage database credentials and rotation.