Aurora vs RDS: When to Choose Amazon Aurora (Architecture and Cost)
A guide to Aurora architecture, I/O cost analysis, and when to choose it over RDS, with migration strategies and real-world decision frameworks.
Choosing between Amazon Aurora and standard RDS isn’t straightforward. AWS markets Aurora at 6x the throughput of MySQL and PostgreSQL, a vendor benchmark worth re-measuring on your own workload. It also offers automatic storage scaling to 256 TiB and a 99.99% availability SLA. But it comes with additional complexity and cost that can surprise teams unfamiliar with its I/O pricing model.
The decision comes down to workload characteristics, operational requirements, and cost constraints. For a production MySQL or PostgreSQL workload that needs a 99.99% SLA, multi-region reads, or read replicas that stay within milliseconds of the writer, Aurora Standard is the sensible default. Switch to I/O-Optimized once I/O passes roughly a quarter of the bill. Stay on RDS when the engine is something else, or when the workload is small, predictable, and budget-bound; the RDS Multi-AZ DB cluster covers sub-minute failover without leaving the RDS engine.
What is Amazon Aurora?#
Amazon Aurora is a cloud-native relational database engine compatible with MySQL and PostgreSQL. Unlike standard RDS which runs vanilla databases on cloud infrastructure, Aurora was built from scratch to leverage distributed cloud architecture.
Key Architectural Differences:
- Storage Separation: Compute (database instances) separated from storage (distributed layer)
- Automatic Scaling: Storage grows with the data up to 256 TiB (Aurora PostgreSQL 15.13+, 16.9+, 17.5+ and Aurora MySQL 3.10+; 128 TiB on earlier versions), no downtime
- Built-in Replication: 6 copies of data across 3 Availability Zones by default
- Limited Engine Support: Only MySQL and PostgreSQL (Aurora doesn’t support other engines)
Where Aurora Sits Among AWS Database Services#
Aurora is one of many AWS database services, each designed for a specific access pattern.
Relational Databases (SQL)#
| Service | Engines | Best For |
|---|---|---|
| Amazon RDS | MySQL, PostgreSQL, MariaDB, Oracle, SQL Server, Db2 | Standard relational workloads, broad engine compatibility |
| Amazon Aurora | MySQL, PostgreSQL only | High availability, read-heavy workloads, cloud-native features |
| Amazon Redshift | PostgreSQL-based | Data warehousing, analytics, OLAP workloads |
NoSQL Databases#
| Service | Type | Best For |
|---|---|---|
| Amazon DynamoDB | Key-value, Document | Serverless apps, gaming, IoT, single-digit millisecond latency |
| Amazon DocumentDB | Document (MongoDB-compatible) | MongoDB workloads, JSON document storage |
| Amazon Keyspaces | Wide-column (Cassandra-compatible) | Cassandra migrations, time-series data |
| Amazon Neptune | Graph | Social networks, fraud detection, knowledge graphs |
| Amazon Timestream | Time-series | IoT metrics, DevOps monitoring, application telemetry. Timestream for LiveAnalytics closed to new customers on June 20, 2025; AWS points new users to Timestream for InfluxDB |
In-Memory and Caching#
| Service | Type | Best For |
|---|---|---|
| Amazon ElastiCache | Redis, Memcached | Caching, session storage, real-time analytics |
| Amazon MemoryDB | Redis-compatible | Durable in-memory database, microsecond reads |
Specialized Services#
| Service | Purpose |
|---|---|
| Amazon OpenSearch | Full-text search, log analytics, application monitoring |
When NOT to Choose Aurora#
- Need SQL Server, Oracle, or Db2? → Use RDS (Aurora doesn’t support these)
- Need document storage with MongoDB compatibility? → Use DocumentDB
- Need key-value with single-digit ms latency at scale? → Use DynamoDB
- Need data warehousing/analytics? → Use Redshift
- Need graph relationships? → Use Neptune
- Need time-series data? → Use Timestream for InfluxDB
Aurora’s Distributed Storage Architecture#
Aurora’s storage layer uses Protection Groups - 10GB segments replicated six ways across three availability zones. This design enables fast recovery and high availability without the overhead of traditional replication.
Quorum-Based Writes: Aurora requires 4 out of 6 acknowledgments for writes to commit. This means it can tolerate losing an entire availability zone plus one additional copy without affecting write availability.
Redo Log Architecture: Aurora only sends redo logs to storage, not full data pages. This reduces write amplification significantly compared to traditional databases that write full pages plus transaction logs.
Self-Healing Storage: The storage layer automatically detects and repairs disk failures, typically recovering a 10GB segment in under one minute without any manual intervention.
Aurora vs RDS: Technical Comparison#
RDS has two high-availability shapes. The classic Multi-AZ DB instance keeps one standby that can’t serve reads. The Multi-AZ DB cluster runs a writer and two readable standbys in three AZs with semisynchronous replication, which puts it between classic RDS and Aurora.
| Aspect | RDS Multi-AZ DB instance (MySQL/PostgreSQL) | RDS Multi-AZ DB cluster | Aurora |
|---|---|---|---|
| Storage | EBS volume per instance | EBS volume per instance, 3 AZs | Distributed storage layer (6 copies, 3 AZs) |
| Storage Scaling | Storage autoscaling or manual increase; usually no outage | Manual increase only (no storage autoscaling) | Automatic, up to 256 TiB, no downtime |
| Replication | Async native replication, up to 15 read replicas per source (MySQL, MariaDB, PostgreSQL), each with its own storage copy | Semisynchronous to 2 readable standbys | Shared cluster volume, up to 15 Aurora Replicas |
| Replica Lag | Depends on write load | Depends on write load; failover waits for it | Typically milliseconds |
| Write Method | Full page writes + double-write buffer | Full page writes + double-write buffer | Redo log only |
| Failover Time | Typically 60-120 seconds | Typically under 35 seconds | Typically under 60 seconds, often under 30 (with a replica); faster with AWS drivers |
| HA SLA | 99.95% | 99.95% | 99.99% (instances in at least two AZs) |
| Backup Impact | Taken from the standby; no I/O pause on the primary, latency can rise briefly | Storage volume snapshot of the whole cluster | Continuous, no performance impact |
Write Performance Characteristics#
Aurora’s redo-log-only approach reduces the number of I/O operations for writes. Traditional databases write:
- Data page to storage
- Transaction log to storage
- Data page to double-write buffer (MySQL)
Aurora writes only the redo log entry, and the storage layer applies these changes asynchronously. The original Aurora paper (SIGMOD 2017) measured the effect with a SysBench write-only test: 7.4 network I/Os per transaction on mirrored MySQL against 0.95 on Aurora, about 7.7 times fewer. That is one benchmark from AWS’s own engineers; the gap on a given workload will differ.
When to Choose Aurora vs RDS#
Choose Aurora When:#
- High availability matters: a 99.99% uptime SLA against Multi-AZ RDS’s 99.95%, sub-minute failover, and a business that genuinely can’t absorb a 1-2 minute database outage. If sub-minute failover is enough and the 99.95% SLA is acceptable, the RDS Multi-AZ DB cluster is the other candidate.
- Read-heavy services draw real value from Aurora’s shared storage layer. RDS also allows 15 read replicas, but each one is a full DB instance with its own copy of the data, billed like any other instance, and its asynchronous lag grows with write load. Aurora readers attach to the same cluster volume, so a new reader adds compute without another storage copy, and lag typically stays in the milliseconds.
- Storage growth that’s hard to forecast removes a maintenance ticket: teams that don’t want to manage provisioning, that expect unpredictable spikes, or that want to avoid over-provisioning storage costs get automatic scaling instead.
- Multi-region reads or failover are required. Cross-region replication with sub-second lag, fast disaster recovery, and global read distribution are what Aurora Global Database exists for.
- Daily traffic that moves 10x, or non-production environments that shouldn’t cost anything when nobody’s using them, is what Serverless v2’s auto-scaling and scale-to-zero handle.
Choose RDS When:#
RDS fits cost-sensitive projects best: a predictable, low-to-moderate workload where the Aurora premium isn’t justified and I/O patterns stay well under the threshold that triggers high Aurora costs. It also covers broader engine requirements, SQL Server, Oracle, MariaDB, or Db2, or an application already tied to a non-Aurora-compatible engine. For single-AZ development or testing environments, basic backup and restore is enough and nothing advanced is needed. Workloads with steady, modest I/O run well on standard storage and IOPS provisioning, and they pay no per-request I/O charge. In the two-AZ example further down, Aurora Standard with one reader is cheaper than a Multi-AZ RDS instance until about 285 million I/O requests a month. The RDS cost edge shows up above that, or on small instances and volumes where Aurora’s per-instance premium outweighs the single storage copy. When the team wants to stay on the RDS engine but needs failover under a minute and readers on the standbys, the Multi-AZ DB cluster covers that, at a higher monthly price than Aurora at the same instance size in that example.
Decision Framework#
Quick Reference:
- Amber (RDS): Engines other than MySQL/PostgreSQL, teams that stay on the RDS engine (the Multi-AZ DB cluster when failover must stay under a minute), and small, predictable, low-I/O workloads
- Blue (Aurora Standard): Where most production MySQL/PostgreSQL workloads land
- Violet (Aurora I/O-Optimized): When I/O costs exceed 25% of your Aurora bill
The replica branch in the diagram asks about lag and storage copies. RDS for MySQL, MariaDB, and PostgreSQL allows 15 read replicas per source, the same ceiling as Aurora. The difference is what each replica costs and how far it trails the writer. An RDS replica is another instance with another copy of the data; an Aurora reader shares the cluster volume.
Cost Analysis and the I/O Trap#
Aurora’s pricing has three components: compute, storage, and I/O. The I/O component often surprises teams making their first migration.
Pricing Breakdown#
Aurora Standard:
- Instance: about 15% above the same RDS instance class (db.r6g.2xlarge for PostgreSQL in us-east-1: $1.038/hour on Aurora, $0.899/hour on RDS Single-AZ)
- Storage: $0.10/GB-month (pay for what you use)
- I/O: $0.20 per million requests
- Backups: First backup free (cluster storage size), additional at $0.021/GB-month
Aurora I/O-Optimized (introduced 2023):
- Instance: 30% more expensive than Standard
- Storage: $0.225/GB-month (2.25x Standard)
- I/O: $0 (included)
- Backups: Same as Standard
Two AZs, Same Instance Size#
High availability changes the comparison. RDS Multi-AZ bills the standby as a second instance ($1.798/hour for db.r6g.2xlarge, exactly double the Single-AZ rate) and doubles the gp3 storage rate, while the standby serves no reads. Aurora bills each reader as its own instance but stores one copy of the data. The table below uses us-east-1 on-demand prices for PostgreSQL, 730 hours a month, and 2,000 GB of data; backups are left out.
| Setup | Instances | Compute / month | Storage / month | Per-request I/O | Total before I/O |
|---|---|---|---|---|---|
| RDS Multi-AZ DB instance | 1 × db.r6g.2xlarge + standby (no reads) | $1,312.54 | $460.00 (gp3, $0.23/GB) | None | $1,772.54 |
| RDS Multi-AZ DB cluster | 3 × db.r6gd.2xlarge (2 readable standbys) | $2,109.70 | $690.00 (gp3, $0.345/GB) | None | $2,799.70 |
| Aurora Standard | writer + 1 reader, db.r6g.2xlarge | $1,515.48 | $200.00 | $0.20 per million | $1,715.48 |
| Aurora I/O-Optimized | writer + 1 reader, db.r6g.2xlarge | $1,969.54 | $450.00 | Included | $2,419.54 |
Before I/O, Aurora Standard with one reader costs about the same as a Multi-AZ RDS instance and adds a readable replica. The two cross at about 285 million I/O requests a month ($57 of I/O); past that point, RDS is cheaper unless the reader is doing work you would otherwise pay for. On RDS, IOPS provisioned above the gp3 baseline are a separate line item. The Multi-AZ DB cluster only runs on a short list of instance classes (db.r6gd, db.m6gd, db.c6gd and a few others), and it runs three of them, which is why it is the most expensive row in the table.
The I/O Cost Trap Explained#
Many teams estimate Aurora costs using instance and storage pricing, then get surprised by I/O charges. A production workload can easily generate 50-100 billion I/O requests per month.
Example Calculation:
interface AuroraConfig {
instanceType: string;
storageGB: number;
monthlyIORequests: number;
}
interface CostBreakdown {
compute: number;
storage: number;
io: number;
total: number;
}
function calculateAuroraCost(
config: AuroraConfig,
optimized: boolean = false
): CostBreakdown {
// Example pricing for us-east-1 (Aurora PostgreSQL, on-demand)
const instancePricing: Record<string, number> = {
'db.r6g.2xlarge': optimized ? 1.349 : 1.038, // per hour
};
const storagePricing = optimized ? 0.225 : 0.10; // per GB-month
const ioPricing = optimized ? 0 : 0.20; // per million requests
const hoursPerMonth = 730;
const computeCost = instancePricing[config.instanceType] * hoursPerMonth;
const storageCost = config.storageGB * storagePricing;
const ioCost = optimized ? 0 : (config.monthlyIORequests / 1_000_000) * ioPricing;
return {
compute: computeCost,
storage: storageCost,
io: ioCost,
total: computeCost + storageCost + ioCost
};
}
// Example: High I/O workload
const highIOWorkload: AuroraConfig = {
instanceType: 'db.r6g.2xlarge',
storageGB: 2000,
monthlyIORequests: 50_000_000_000, // 50 billion I/O requests
};
const standardCost = calculateAuroraCost(highIOWorkload, false);
const optimizedCost = calculateAuroraCost(highIOWorkload, true);
console.log('Aurora Standard:', standardCost);
// { compute: 757.74, storage: 200, io: 10000, total: 10957.74 }
console.log('Aurora I/O-Optimized:', optimizedCost);
// { compute: 984.77, storage: 450, io: 0, total: 1434.77 }
// Rule of thumb: Switch to I/O-Optimized when I/O > 25% of total cost
const ioPercentage = (standardCost.io / standardCost.total) * 100;
console.log(`I/O is ${ioPercentage.toFixed(1)}% of total cost`);
// I/O is 91.3% of total cost - definitely use I/O-Optimized!
Cost Optimization Strategies#
1. Monitor I/O Metrics from Day One
Track VolumeReadIOPs and VolumeWriteIOPs in CloudWatch immediately after migration. These metrics report measured consumption, so they replace the guesswork in your cost model.
2. Increase Buffer Cache Larger instances with more memory reduce I/O by improving cache hit ratios. Sometimes paying for a larger instance saves money on I/O costs.
3. Query Optimization Reduce unnecessary I/O through better indexing, query optimization, and avoiding full table scans.
4. Switch to I/O-Optimized Strategically When I/O costs exceed 25% of total Aurora bill, I/O-Optimized almost always costs less. Use AWS Compute Optimizer to get specific recommendations.
5. Serverless v2 for Variable Workloads For development and staging, Serverless v2 with a 0 ACU minimum (November 2024 feature) drops the compute charge to zero while instances are paused. Storage and backups keep billing, and I/O still counts under Standard, so the idle cost shrinks rather than disappears. The pricing example further down compares compute only. The saving depends on the baseline: about 22% against a memory-matched db.t4g.medium running all month, about 78% against a db.r6g.large.
Aurora Serverless v2#
Aurora Serverless v2 addresses the scaling limitations of traditional provisioned instances with automatic capacity adjustment based on actual load.
Key Features (2024/2025 Updates)#
- Instant Scaling to 256 ACUs (October 2024): Previously limited to 128 ACUs
- Scale to 0 ACUs (November 2024): Previously minimum was 0.5 ACU
- Fine-Grained Scaling: Adjusts in 0.5 ACU increments
- Feature Support: Works with Global Database and Performance Insights, though auto-pause is off for the writer of a global primary, for global secondaries, and for any cluster with an RDS Proxy attached
1 ACU = approximately 2GB of memory + proportional CPU and network bandwidth
Serverless v2 Configuration#
import * as cdk from 'aws-cdk-lib';
import * as rds from 'aws-cdk-lib/aws-rds';
const serverlessCluster = new rds.DatabaseCluster(this, 'ServerlessCluster', {
engine: rds.DatabaseClusterEngine.auroraPostgres({
version: rds.AuroraPostgresEngineVersion.VER_16_9, // auto-pause needs 16.3+, 256 TiB needs 16.9+
}),
vpc,
writer: rds.ClusterInstance.serverlessV2('writer', {
autoMinorVersionUpgrade: true,
}),
readers: [
rds.ClusterInstance.serverlessV2('reader1', {
scaleWithWriter: true, // Reader scales with writer
}),
],
serverlessV2MinCapacity: 0, // Scale to zero: instances pause when idle (Nov 2024 feature)
serverlessV2AutoPauseDuration: cdk.Duration.minutes(10), // Idle time before pausing (5 min to 24 h)
serverlessV2MaxCapacity: 256, // Up to 256 ACUs (Oct 2024 feature)
});
// Note: 0 ACU minimum requires PostgreSQL 13.15+, 14.12+, 15.7+, 16.3+
// or MySQL 3.08+
Scale-to-zero is an auto-pause with conditions. An instance pauses only after the idle interval passes with no user connections, so an open pool, an application health check that opens a connection, or an RDS Proxy keeps it running. Logical replication (PostgreSQL) or binlog replication (MySQL) keeps the writer awake too. The first connection after a pause waits for the resume, typically about 15 seconds and 30 seconds or more after a pause longer than 24 hours, so client connect timeouts need to sit above that. The Aurora Serverless v2 architecture deep dive covers the scaling mechanics in more depth.
Use Cases for Serverless v2#
1. Variable/Unpredictable Workloads E-commerce during flash sales, seasonal applications, or marketing campaign traffic spikes.
2. Development and Staging Environments Scale to 0 when not in use. A development database used 8 hours/day, 5 days/week cuts its compute bill; how much depends on what it would otherwise run on (see the pricing example below).
3. Multi-Tenant SaaS Per-tenant databases with independent scaling. Each tenant’s database scales based on their actual usage.
4. Infrequent Batch Jobs Data processing that runs daily or weekly. Scale to minimum between runs.
Pricing Example#
// Serverless v2 pricing (us-east-1)
const acuPricePerHour = 0.12; // PostgreSQL
// Example: Dev environment
// Used 8 hours/day, 5 days/week at average 2 ACUs
// Scales to 0 ACUs when not in use
const monthlyHoursActive = 8 * 5 * 4.33; // ~173.2 hours/month
const avgACUs = 2;
const serverlessV2Cost = monthlyHoursActive * avgACUs * acuPricePerHour;
// = 173.2 * 2 * 0.12 = $41.57/month
// 1 ACU is about 2 GiB of memory, so 2 ACUs match a 4 GiB instance.
// Provisioned Aurora PostgreSQL, running all month (730 hours):
const memoryMatched = 730 * 0.073; // db.t4g.medium, 4 GiB: $53.29/month
const withHeadroom = 730 * 0.26; // db.r6g.large, 16 GiB: $189.80/month
const savings = (baseline: number) =>
((baseline - serverlessV2Cost) / baseline) * 100;
// savings(memoryMatched) = 22.0%, savings(withHeadroom) = 78.1%
The comparison covers compute only and ignores the idle interval before each pause. It also assumes nothing holds a connection open overnight; one forgotten connection keeps the instance from pausing, so it bills ACUs around the clock.
Migration from RDS to Aurora#
Migration Methods#
1. Aurora Read Replica (Recommended - Minimal Downtime)
This method creates an Aurora cluster that replicates from your existing RDS for MySQL instance through binary log replication, then promotes it to a standalone cluster. The Aurora read replica is a DB cluster, so the CLI creates the cluster first and its writer instance second.
# Step 1: Create the Aurora cluster as a replica of the RDS for MySQL instance
# (no master user or password: they come from the source)
aws rds create-db-cluster \
--db-cluster-identifier myapp-aurora-cluster \
--engine aurora-mysql \
--db-subnet-group-name myapp-db-subnets \
--vpc-security-group-ids sg-0123456789abcdef0 \
--replication-source-identifier arn:aws:rds:us-east-1:123456789012:db:myapp-rds-mysql
# Step 2: Add the writer instance (the CLI doesn't create it for you)
aws rds create-db-instance \
--db-cluster-identifier myapp-aurora-cluster \
--db-instance-identifier myapp-aurora-writer \
--db-instance-class db.r6g.2xlarge \
--engine aurora-mysql
# Step 3: Watch binlog replication lag in seconds on the writer
aws cloudwatch get-metric-statistics \
--namespace AWS/RDS \
--metric-name AuroraBinlogReplicaLag \
--dimensions Name=DBClusterIdentifier,Value=myapp-aurora-cluster Name=Role,Value=WRITER \
--start-time 2025-11-29T00:00:00Z \
--end-time 2025-11-29T01:00:00Z \
--period 60 \
--statistics Maximum
# Step 4: After writes to RDS stop and lag reads 0, promote
aws rds promote-read-replica-db-cluster \
--db-cluster-identifier myapp-aurora-cluster
Creating the replica takes a while (AWS estimates several hours per TiB of data), but the application keeps running on RDS throughout. The write outage is the cutover window:
- Stop writes on the RDS instance (put the application in read-only or maintenance mode).
- Wait until
AuroraBinlogReplicaLagreaches 0. Writing to Aurora before that risks breaking replication. - Promote the Aurora cluster with
promote-read-replica-db-cluster. - Switch the application’s connection string to the Aurora cluster endpoint and resume writes.
Downtime: the length of that window, set mostly by how fast lag drains and how fast the application switches endpoints. A rehearsal in staging gives the real number.
2. Snapshot Migration
Restore an RDS snapshot as an Aurora cluster. Faster for large databases but requires downtime during cutover.
aws rds restore-db-cluster-from-snapshot \
--db-cluster-identifier myapp-aurora \
--snapshot-identifier myapp-rds-snapshot \
--engine aurora-postgresql \
--engine-version 16.9
# The restored cluster has no instances yet: add a writer with create-db-instance, as in method 1
Downtime: Full duration of snapshot restore plus testing time
3. AWS DMS (Database Migration Service)
Most flexible but most complex. Good for cross-account, cross-VPC, or when converting encrypted/unencrypted databases.
4. pg_dump/mysqldump
Simple but slow. Only practical for databases under 500GB.
Pre-Migration Checklist#
- Verify Aurora supports your RDS engine version
- Estimate I/O costs using CloudWatch metrics
- Test application with Aurora in staging environment
- Plan connection pooling strategy (consider RDS Proxy)
- Document rollback procedure
- Disable auto minor version upgrades on RDS
- Schedule migration during low-traffic period
- Prepare monitoring and alerting for new Aurora cluster
Global Database for Multi-Region#
Aurora Global Database provides cross-region replication with sub-second lag, enabling global read distribution and fast disaster recovery.
Architecture#
- 1 Primary Region: Accepts read and write traffic
- Up to 10 Secondary Regions: Read-only (increased from 5 in May 2025)
- Typical Replication Lag: Less than 1 second
- Dedicated Infrastructure: Replication doesn’t use public internet
Global Database Setup#
A secondary cluster joins the global database when it’s created: the documented way to add a Region creates a new cluster with the global cluster identifier already set. The CDK L2 DatabaseCluster has no property for that identifier and generates master credentials by default, which a secondary takes from the primary instead. So the secondary side uses the L1 CfnDBCluster directly. The two stacks deploy in order: primary first, then the secondary region.
import * as rds from 'aws-cdk-lib/aws-rds';
import * as ec2 from 'aws-cdk-lib/aws-ec2';
import * as kms from 'aws-cdk-lib/aws-kms';
// Primary region (us-east-1): an ordinary L2 cluster
const primaryCluster = new rds.DatabaseCluster(primaryStack, 'PrimaryCluster', {
engine: rds.DatabaseClusterEngine.auroraPostgres({
version: rds.AuroraPostgresEngineVersion.VER_16_9,
}),
vpc: primaryVpc,
storageEncrypted: true,
writer: rds.ClusterInstance.provisioned('writer', {
instanceType: ec2.InstanceType.of(ec2.InstanceClass.R6G, ec2.InstanceSize.XLARGE2),
}),
});
// The global cluster takes engine and version from the source cluster,
// so engine and engineVersion must not be set here
new rds.CfnGlobalCluster(primaryStack, 'GlobalCluster', {
globalClusterIdentifier: 'myapp-global',
sourceDbClusterIdentifier: primaryCluster.clusterArn,
});
// Secondary region (eu-west-1), separate stack deployed after the primary.
// L1 cluster that joins the global database at creation:
// no master credentials, same engine version as the primary.
const secondaryKey = new kms.Key(secondaryStack, 'SecondaryKey');
const secondarySubnets = new rds.CfnDBSubnetGroup(secondaryStack, 'SecondarySubnets', {
dbSubnetGroupDescription: 'Aurora global secondary',
subnetIds: secondaryVpc.selectSubnets({
subnetType: ec2.SubnetType.PRIVATE_WITH_EGRESS,
}).subnetIds,
});
const secondaryCluster = new rds.CfnDBCluster(secondaryStack, 'SecondaryCluster', {
globalClusterIdentifier: 'myapp-global', // plain string: no cross-region token
engine: 'aurora-postgresql',
engineVersion: '16.9',
dbSubnetGroupName: secondarySubnets.ref,
storageEncrypted: true,
kmsKeyId: secondaryKey.keyArn, // a key that lives in the secondary region
});
new rds.CfnDBInstance(secondaryStack, 'SecondaryReader', {
dbClusterIdentifier: secondaryCluster.ref,
dbInstanceClass: 'db.r6g.2xlarge',
engine: 'aurora-postgresql',
});
The global cluster identifier travels between stacks as a plain string. Passing primaryCluster.clusterArn or another token across regions would need crossRegionReferences on the stacks; a fixed name avoids that.
Failover Capabilities#
Planned Switchover (Managed):
- Zero data loss
- Maintains cluster topology
- Use case: Regional rotation, compliance requirements
Unplanned Failover:
- Promotes secondary to primary in approximately 1 minute
- Potential data loss depends on replication lag at failure time
- RPO typically seconds, RTO approximately 1 minute
Cost Considerations#
Global Database adds cost in several areas, and it’s worth implementing only when business requirements genuinely need multi-region active-active reads or sub-minute regional failover:
- Cross-region data transfer charges
- Storage replicated to all regions
- Instance costs in each region
- I/O charges in each region (Standard) or increased instance costs (I/O-Optimized)
Connection Management with RDS Proxy#
Aurora’s fast failover capabilities work best when combined with intelligent connection management. RDS Proxy provides connection pooling and handles failover transparently.
import * as rds from 'aws-cdk-lib/aws-rds';
import * as ec2 from 'aws-cdk-lib/aws-ec2';
import * as cdk from 'aws-cdk-lib';
const proxy = new rds.DatabaseProxy(this, 'AuroraProxy', {
proxyTarget: rds.ProxyTarget.fromCluster(auroraCluster),
secrets: [auroraCluster.secret!],
vpc,
dbProxyName: 'myapp-aurora-proxy',
// Connection pooling configuration
maxConnectionsPercent: 90,
maxIdleConnectionsPercent: 50,
connectionBorrowTimeout: cdk.Duration.seconds(120),
// Session pinning filters - avoid unnecessary pinning
sessionPinningFilters: [
rds.SessionPinningFilter.EXCLUDE_VARIABLE_SETS,
],
requireTLS: true,
});
// Application connects to proxy endpoint instead of cluster endpoint
const proxyEndpoint = proxy.endpoint;
Benefits:
- Maintains connection pool across Lambda invocations
- Handles failover without application-level retry logic
- Reduces database connections by 90%+ for serverless workloads
- Enforces IAM authentication for additional security
When RDS Proxy is Essential:
- Serverless applications (Lambda functions)
- Applications with connection storms
- Microservices with many independent services
- Multi-tenant applications with per-tenant connection patterns
Where Aurora Deployments Break in Production#
1. Stale Connections After Failover#
After a failover, the cluster endpoint points at a different instance, and the IP address behind it can change. Two things go wrong. A client that caches DNS longer than AWS’s recommended 30 seconds reconnects to an address that’s no longer the writer. More often, a connection pool keeps sockets that were opened to the old writer, and those connections fail or land on an instance that now rejects writes. In Node.js, dns.lookup() goes through the operating system resolver (getaddrinfo) for every new connection, so the stale state usually sits in the pool.
The fix that matches “faster with AWS drivers” in the comparison table is a failover-aware driver. The AWS Advanced NodeJS Wrapper sits on top of pg or mysql2 and reads the cluster topology from the database itself, so it finds the new writer without waiting for DNS. When failover succeeds mid-query, it throws an error that tells the application to restore session state and repeat the statement.
import { AwsPgClient } from 'aws-advanced-nodejs-wrapper/pg';
import {
FailoverSuccessError,
TransactionResolutionUnknownError,
} from 'aws-advanced-nodejs-wrapper';
// Connect to the cluster endpoint. The default plugin set includes failover2
// and efm2, so the wrapper tracks the cluster topology instead of trusting DNS.
const client = new AwsPgClient({
host: process.env.DB_HOST,
port: 5432,
user: process.env.DB_USER,
password: process.env.DB_PASSWORD,
database: 'app',
});
async function restoreSessionState(): Promise<void> {
await client.query("SET TIME ZONE 'UTC'");
}
export async function query(text: string, values: unknown[] = []) {
try {
return await client.query(text, values);
} catch (error) {
if (error instanceof FailoverSuccessError) {
// Same client, now connected to the new writer. Session state is gone:
// restore it, then repeat the statement once.
await restoreSessionState();
return await client.query(text, values);
}
if (error instanceof TransactionResolutionUnknownError) {
// The open transaction may or may not have committed, and session
// state is gone. Restore it here; the caller checks the outcome and
// restarts the whole transaction on the restored connection.
await restoreSessionState();
}
throw error; // also FailoverFailedError and errors unrelated to failover
}
}
await client.connect();
await restoreSessionState();
Applications that stay on the plain pg driver can still limit the damage: maxLifetimeSeconds on the Pool retires every connection after a fixed age, so none outlives a failover by long, and a catch-and-retry around queries absorbs the first failed attempt. RDS Proxy is the third route; it keeps client connections open and moves them to the new writer itself. Whichever route you take, a failover test in staging is what proves it works.
2. Wrong Instance Class Selection#
Production workloads sometimes end up on t2/t3/t4g burstable instances, which hold up fine in development but can’t sustain the consistent CPU load production needs; r6g or r6i instance families are the safer choice there.
3. Replica Lag from CPU Credit Exhaustion#
T-instance read replicas run out of CPU credits, so replication lag climbs and the instances eventually restart. The CPUCreditBalance metric flags the exhaustion early; non-burstable instance types avoid the problem altogether on production read replicas.
4. Connection Exhaustion#
Serverless applications can create thousands of short-lived connections that exhaust the database’s connection limit, and for Lambda specifically the fix is close to mandatory: RDS Proxy or application-side connection pooling.
5. Parallel Query Cost Spike#
Enabling parallel query increases I/O costs unexpectedly because it bypasses the buffer cache; VolumeReadIOPs is worth watching right after turning it on. I/O-Optimized absorbs the spike when parallel query is critical for the workload.
6. CloudFormation Data Loss Risk#
CloudFormation stack updates can recreate instances and potentially lose data in the process, which is why database resources need DeletionPolicy: Retain and change sets deserve a careful read before applying them.
7. Binary Logging Performance#
Large transactions (1M+ inserts) become very slow with binary logging enabled. Batch them into smaller transactions (10K-50K inserts), or disable binary logging if point-in-time recovery isn’t required.
Monitoring and Operations#
Key Metrics to Monitor#
Performance Metrics:
CPUUtilization: Target less than 80% averageDatabaseConnections: Monitor againstmax_connectionssettingBufferCacheHitRatio: Target greater than 95%AuroraReplicaLag: Target less than 100ms
I/O and Storage Metrics:
VolumeReadIOPs,VolumeWriteIOPs: Watch for cost spikesVolumeBytesUsed: Tracks automatic storage growthDiskQueueDepth: Indicates I/O bottlenecks
Availability Metrics:
FailoverLatency: Measure actual failover timeDeadlockCount: Application design issuesCommitLatency: Write performance
Operational Best Practices#
1. Enable Enhanced Monitoring Provides OS-level metrics (memory, CPU, disk I/O) at 1-second granularity. Critical for production troubleshooting.
2. Use Performance Insights Query-level analysis shows which queries consume resources. Free tier includes 7 days of retention.
3. Set CloudWatch Alarms Alert on key metrics before they become problems:
- CPU > 80% for 5 minutes
- Replica lag > 1 second
- Connections > 80% of max_connections
- BufferCacheHitRatio < 90%
4. Test Failover Quarterly Regular failover testing validates your actual RTO. Many teams discover DNS caching or stale pool connections only during production incidents.
5. Use AWS Compute Optimizer Provides rightsizing recommendations based on actual usage patterns. Can identify opportunities to switch to I/O-Optimized or downsize instances.
When Aurora Is Worth It#
The boundary runs along engine support, workload size, and I/O share. Production MySQL and PostgreSQL clusters that need the 99.99% SLA, multi-region reads, readers that stay within milliseconds of the writer, or storage that grows without a maintenance window belong on Aurora Standard. Once VolumeReadIOPs and VolumeWriteIOPs push I/O past a quarter of the bill, move to I/O-Optimized, and for environments that sit idle most of the week, Serverless v2 fits better than either.
Cross that boundary the other way when the engine has to be Oracle, SQL Server, MariaDB, or Db2, when the workload is small and predictable enough that provisioned RDS storage and IOPS already fit, or when a purpose-built service such as DynamoDB, Redshift, or Neptune matches the access pattern better than any relational engine. A team that needs sub-minute failover but wants to stay on the RDS engine has the Multi-AZ DB cluster as a middle option.
The cheapest first step is a week of CloudWatch I/O data from the existing RDS instance. That number decides the pricing mode and, often, whether the migration is worth running at all.
References#
- What is Amazon Aurora? (opens in new tab) - Official overview of Aurora’s architecture, cluster model, and compatibility with MySQL and PostgreSQL
- Amazon Aurora Storage and Reliability (opens in new tab) - Detailed explanation of Aurora’s distributed storage layer and six-way replication across Availability Zones
- High Availability for Amazon Aurora (opens in new tab) - Aurora failover mechanisms, read replica promotion, and multi-AZ cluster behavior
- Amazon Aurora Product Page (opens in new tab) - Feature overview, pricing model options, and comparison with standard RDS
- Amazon Aurora DB Clusters (opens in new tab) - Primary and reader instance roles, endpoint types, and cluster volume management
- Amazon RDS Proxy Documentation (opens in new tab) - Connection pooling proxy for Aurora, essential for serverless and Lambda-based workloads
- Amazon Aurora Size Limits (opens in new tab) - Cluster volume maximums by engine version, including the 256 TiB limit for newer releases
- Working with MySQL Read Replicas (opens in new tab) - The 15-replica limit per source instance and the advice to size replicas like the source
- Multi-AZ DB Cluster Deployments (opens in new tab) - Architecture of the writer plus two readable standbys, semisynchronous replication, and replica lag
- Failing Over a Multi-AZ DB Cluster (opens in new tab) - Typical failover time under 35 seconds for the Multi-AZ DB cluster
- Failing Over a Multi-AZ DB Instance (opens in new tab) - Typical failover time of 60-120 seconds for the classic Multi-AZ deployment
- Managing Automated Backups (opens in new tab) - Backup window behavior, including why Multi-AZ backups for MariaDB, MySQL, Oracle, and PostgreSQL don’t suspend I/O on the primary
- Amazon RDS Storage Autoscaling (opens in new tab) - How RDS grows storage automatically when free space runs low
- Migrating RDS for MySQL to Aurora with an Aurora Read Replica (opens in new tab) - The
create-db-cluster --replication-source-identifierflow, the cutover rule (stop writes, lag 0), and promotion - Aurora Serverless v2 Auto-Pause (opens in new tab) - Version requirements, the conditions that block pausing, and the resume delay
- AWS::RDS::GlobalCluster (opens in new tab) - CloudFormation reference with the template for adding a secondary Region cluster
- AWS Advanced NodeJS Wrapper: Failover Plugin (opens in new tab) - Failover error types and what the application should do after each one
- Amazon Aurora: Design Considerations for High Throughput Cloud-Native Relational Databases (opens in new tab) - SIGMOD 2017 paper with the I/Os-per-transaction measurement against mirrored MySQL
- Amazon Aurora Pricing (opens in new tab) - Pricing model for Standard and I/O-Optimized, with the storage, I/O, and ACU rates used in the examples
- Timestream for LiveAnalytics Availability Change (opens in new tab) - Closure to new customers and the pointer to Timestream for InfluxDB
Related posts
What Aurora Serverless v2 is under the hood: shared storage, ACU-driven compute, platform versions, the Caspian substrate, scale-to-zero, and mixed-mode clusters.
aws · data-storage-orm · architecture +1
Advanced AWS Lambda patterns and cost optimization: Lambda Layers, VPC configuration, cross-account execution, and architectural decisions.
lambda · serverless · cost-optimization +5
Keep identity reads in DynamoDB, route sort, filters, facets, and full text to a zero-ETL OpenSearch read model, with a staging checklist and a PostgreSQL override.
dynamodb · aws · architecture +2
A decision framework for the TypeScript data layer on Postgres: how much SQL the library should own, what it costs on Lambda, and when the default is wrong.
typescript · postgresql · data-storage-orm +1
Before building an internal service layer, decide whether you need one: what it costs per call, the volume where VPC Lattice wins, and when direct invoke still beats it.
aws · aws-cdk · lambda +4