Operate RDS and Aurora: access, pooling and recovery
Pick an RDS or Aurora deployment, connect privately through a proxy, add a read replica and restore to a point in time.
By Invicly Tech, , in AWS Cloud Engineering. About 11 minutes to read.
In short
Amazon RDS runs a managed relational database engine on instances you size, while Aurora is AWS's MySQL- and PostgreSQL-compatible engine with a shared, replicated storage layer. Both belong in private subnets, reached only by your app's security group. RDS Proxy pools connections, read replicas take read traffic, and automated backups let you restore to a point in time.
Explained simply
Many apps need a relational database: tables, SQL, joins and transactions. Amazon RDS runs engines like PostgreSQL and MySQL for you. AWS handles installing, patching, backups and failover, and you choose the instance size and settings. Aurora is a related option that is compatible with PostgreSQL or MySQL but uses its own storage layer built for the cloud.
The database should never sit on the public internet. You place it in private subnets and allow connections only from your app's security group. To reach it from a laptop for maintenance, you go through Session Manager port forwarding, a bastion host or a VPN.
Apps such as Lambda functions can open hundreds of short connections. Databases do not like that. RDS Proxy sits in between and reuses a smaller pool of connections. Read replicas are extra copies that answer read-only queries, so the main database has more room for writes.
Mistakes happen, such as a wrong DELETE. Automated backups keep snapshots and transaction logs, so you can restore the database to almost any second in the retention window. The restore becomes a new database; you check it, then switch the app or copy the missing rows back.
Press Play on a diagram to walk through it one step at a time.
- 1App (Lambda, ECS task or EC2)
In private app subnets, own security group
- 2RDS Proxy
Pools and reuses connections, gets credentials from Secrets Manager
- 3Writer endpoint
Primary instance, accepts reads and writes
- 4Reader endpoint or read replica
Asynchronous copy for read-only queries
- 5Storage and automated backups
Snapshots plus transaction logs for point-in-time restore
- Engineer to Amazon RDS: Find latest restorable time and incident time1Find latest restorable time and incident time
- Engineer to Amazon RDS: Restore to 10:01, one minute before the DELETE2Restore to 10:01, one minute before the DELETE
- Amazon RDS to Restored DB: Create new instance from snapshot plus logs3Create new instance from snapshot plus logs
- Engineer to Restored DB: Query the lost rows and verify counts4Query the lost rows and verify counts
- Engineer to Amazon RDS: Copy rows back into the live database5Copy rows back into the live database
- App to Amazon RDS: Keeps using the original endpoint6Keeps using the original endpoint
In depth
RDS or Aurora: what is really different
With RDS for PostgreSQL or MySQL, each instance has its own EBS-style storage. Multi-AZ adds a synchronous standby in another AZ that takes over in about a minute or two if the primary fails. A Multi-AZ DB cluster deployment instead has two readable standbys. Aurora separates compute from storage: one cluster volume keeps six copies of data across three AZs, and up to 15 Aurora Replicas read from that same volume, so replica lag is usually small and any replica can be promoted. Aurora also offers Aurora Serverless v2, which scales capacity in fine steps, and Global Database for cross-Region reads. RDS is often cheaper for small, steady workloads and supports more engines, including SQL Server, Oracle and Db2.
- Primary plus one synchronous standby
- Standby serves no reads
- Read replicas are separate instances
- More engine choices
- Shared storage, six copies in three AZs
- Up to 15 readers on the same volume
- Reader endpoint balances reads
- Serverless v2 option for variable load
Private networking for the database
Create a DB subnet group from private subnets in at least two AZs, and set publicly accessible to false. Give the database a security group that allows the engine port, 5432 for PostgreSQL or 3306 for MySQL, only from the app's security group, not from a CIDR range. Store the master password in Secrets Manager; RDS can manage and rotate it for you. Turn on TLS in the client and, if you like, require it on the server with a parameter such as rds.force_ssl for PostgreSQL. For admin access, start an SSM Session Manager port-forwarding session through an instance in the VPC, so no inbound port opens to the internet.
- DB subnet group in two or more private subnets
- Security group rule source = app security group
- Credentials in Secrets Manager
- TLS from client to database
Connection pooling with RDS Proxy
Each database connection uses memory on the server, and PostgreSQL in particular struggles with thousands of them. Serverless apps make this worse because each concurrent Lambda environment may hold its own connection. RDS Proxy keeps a pool of connections to the database and hands them to clients as needed. It reads credentials from Secrets Manager or accepts IAM authentication, runs inside your VPC and keeps client connections open during a failover, which shortens the outage seen by the app. Some session features, such as certain SET commands or temporary tables, pin a client to one connection and reduce the benefit, so watch the pinning metrics. RDS Proxy is billed per vCPU or capacity unit of the database behind it and is not part of any free offer.
Point-in-time restore and its limits
Automated backups take a daily snapshot and keep transaction logs, so you can restore to any second between the earliest restorable time and the latest restorable time, which is usually within the last five minutes. Retention is set from 1 to 35 days; setting it to 0 turns automated backups off and removes point-in-time restore. Every restore creates a new instance or cluster with a new endpoint, using default security groups and parameter groups unless you specify them, so pass the right subnet group, security groups and parameter group. Large databases take time to restore, so measure it. Manual snapshots are kept until you delete them and are useful before risky changes such as major upgrades.
- Restore window: retention days, up to the last few minutes
- Always creates a new resource
- Set subnet group, security groups and parameter group on restore
- Take a manual snapshot before risky changes
Learn it in 5 short steps
About 35m each. Track them with a timer in your plan.
- 1Compare RDS and Aurora~35m
- 2Place the database in private subnets~35m
- 3Pool connections with RDS Proxy~35m
- 4Add a read replica~35m
- 5Restore to a point in time~35m
Key points
- Multi-AZ keeps a synchronous standby for failover; in a classic Multi-AZ instance the standby does not serve reads.
- Read replicas use asynchronous replication, so reads can be slightly stale.
- RDS Proxy helps when many short-lived clients, such as Lambda functions, open connections.
- Point-in-time restore always creates a new instance or cluster; you then point the app at it.
- Aurora stores six copies of data across three AZs and supports up to 15 Aurora Replicas.
Key terms
Tap a card to flip it. 0/5 known
Examples
aws rds restore-db-instance-to-point-in-time \
--source-db-instance-identifier files-db \
--target-db-instance-identifier files-db-restore-1 \
--restore-time 2026-11-30T09:55:00Z \
--db-subnet-group-name private-db-subnets \
--no-publicly-accessible
aws rds wait db-instance-available --db-instance-identifier files-db-restore-1The restore is a new instance; check it, then switch the app's endpoint or copy the rows you need back.
Connect Lambda to PostgreSQL through RDS Proxy
Prerequisites: an RDS PostgreSQL instance in private subnets and a secret in Secrets Manager. Step 1: create a proxy that uses the secret, in the same VPC and private subnets. Step 2: register the database as its target. Step 3: allow the Lambda security group to reach the proxy on 5432, and the proxy to reach the database. Step 4: change the function's connection string to the proxy endpoint. Evidence: the DatabaseConnections metric on the database stays flat while Lambda concurrency rises. Note: an RDS instance and proxy are billed hourly; delete them after the lab.
aws rds create-db-proxy --db-proxy-name files-proxy --engine-family POSTGRESQL \
--auth '[{"AuthScheme":"SECRETS","SecretArn":"arn:aws:secretsmanager:eu-west-1:<account-id>:secret:files-db","IAMAuth":"DISABLED"}]' \
--role-arn arn:aws:iam::<account-id>:role/files-proxy-secrets \
--vpc-subnet-ids subnet-0aaa subnet-0bbb --vpc-security-group-ids sg-0proxy
aws rds register-db-proxy-targets --db-proxy-name files-proxy \
--db-instance-identifiers files-db
aws rds describe-db-proxies --db-proxy-name files-proxy --query "DBProxies[0].Endpoint"Add a read replica for reports
A nightly report slows the app. Step 1: create a read replica of the primary in another AZ. Step 2: point only the reporting job at the replica endpoint. Step 3: watch ReplicaLag in CloudWatch; if it climbs above what the report can tolerate, size the replica up. Evidence: CPU on the primary falls during the report window. Remember that a replica is not a backup: deletes on the primary reach it too. Local alternative: run two PostgreSQL containers with streaming replication to see the same idea for free.
aws rds create-db-instance-read-replica \
--db-instance-identifier files-db-reports \
--source-db-instance-identifier files-db \
--availability-zone eu-west-1b
aws cloudwatch get-metric-statistics --namespace AWS/RDS --metric-name ReplicaLag \
--dimensions Name=DBInstanceIdentifier,Value=files-db-reports \
--start-time 2026-12-01T00:00:00Z --end-time 2026-12-01T06:00:00Z \
--period 300 --statistics MaximumQuick reference
- Multi-AZ = availability (failover); read replicas = read scaling; neither replaces backups
- Backup retention 1 to 35 days; 0 disables automated backups and point-in-time restore
- Point-in-time restore always creates a new instance with a new endpoint
- Allow port 5432 or 3306 only from the app's security group, never 0.0.0.0/0
- RDS Proxy: pooled connections, Secrets Manager or IAM auth, faster failover
- Aurora: six copies across three AZs, up to 15 replicas, reader endpoint
- Admin access: SSM port forwarding instead of a public database
Common mistakes
- Making the database publicly accessible to connect from a laptop, instead of using a bastion, Session Manager port forwarding or a VPN.
- Treating a read replica as a backup: a bad DELETE replicates to it within seconds.
- Opening a new connection per Lambda invocation without a proxy, which exhausts max_connections under load.
Quick quiz
Pick an answer to see if you're right and why.
Practice exercises
Try each one yourself first. Use the hint if you get stuck, then compare with the solution.
- Exercise 1easy
For each need, say Multi-AZ, read replica, point-in-time restore or manual snapshot: survive an AZ outage, run heavy reports, undo a bad UPDATE from 20 minutes ago, keep a copy before a major version upgrade.
- Exercise 2medium
Write the CLI command to restore files-db to its latest restorable time as files-db-check, in the private subnet group, with security group sg-0db and not publicly accessible.
- Exercise 3hard
A team runs a small PostgreSQL app with spiky traffic, a 15-minute RPO and a 2-hour RTO, and wants low cost. Recommend RDS or Aurora, the deployment option and the backup setup, with one reason each.
Check yourself
Answer in your head, reveal, then be honest with yourself.
Feel confident about this topic?
Frequently asked questions
- Is Aurora always better than RDS?
- No. Aurora shines for high availability, many readers and variable load, but small steady databases are often cheaper on RDS, and RDS supports more engines.
- Can I connect to RDS from my laptop?
- Yes, without making it public: use SSM Session Manager port forwarding through an instance in the VPC, a bastion host or a VPN.
- Is a read replica a backup?
- No. It copies every change, including mistakes, within seconds. Use automated backups and snapshots for recovery.
- Can I practise without an RDS bill?
- Free offers for new AWS accounts changed in 2025, so check the current terms. For a free run, use PostgreSQL in Docker for SQL work and write the RDS steps as a design.