Amazon Aurora: storage, endpoints, Serverless v2 and Global Database
Understand how Aurora separates compute from a six-copy, three-AZ storage volume, use writer and reader endpoints from .NET, size Aurora Serverless v2, measure a real failover, and design cross-Region DR with Aurora Global Database.
Assumes: .NET 10 LTS · Npgsql 10.0.3 · AWS CLI v2 · Aurora PostgreSQL 16/17 · Terraform AWS provider 6.x · Region us-east-1. Verified against official sources on 2026-11-18.
Learning objectives
By the end of this lesson you can:
- Explain Aurora's architecture: compute instances on top of a shared cluster volume that keeps six copies of your data across three Availability Zones.
- Use the cluster (writer), reader, custom and instance endpoints correctly from a .NET application.
- Choose between Aurora Standard and I/O-Optimized storage, and between provisioned instances and Aurora Serverless v2, including scale-to-zero (auto-pause).
- Measure a real failover with a C# "failover stopwatch", and explain promotion tiers.
- Design cross-Region disaster recovery with Aurora Global Database: switchover vs failover, write forwarding, and the limits that matter.
- Place Aurora DSQL correctly: when a distributed, active-active SQL database is worth its feature gaps.
Prerequisites
- Amazon RDS for SQL Server and PostgreSQL: parameter groups, subnet groups, encryption at creation
- Choosing a database: SQL vs NoSQL on AWS
- Tools: AWS CLI v2 (
learn-sandbox), .NET 10 SDK, a way into your VPC (CloudShell VPC environment or a bastion via Session Manager) for the failover exercise
Why this matters in banking
Harbourline's ledger runs on RDS for PostgreSQL with Multi-AZ. One evening, an Availability Zone has a hardware problem. The standby takes over as designed, but the operations log shows payments API errors for about two minutes, and a long tail of connection errors as clients hold on to stale DNS. Treasury asks two questions:
- "Can we get that under 30 seconds?"
- "What is our plan if the whole London Region is unavailable?"
The regulator's operational resilience expectations make the second question real: important business services must stay within an impact tolerance that the bank sets itself.
Aurora is AWS's answer to both. It fails over faster because the new writer doesn't need its own copy of the data: the storage is shared. It replicates across Regions at the storage layer, typically with under a second of lag. It costs more, and it has its own sharp edges. This lesson helps you decide when that trade is worth it and how to prove the numbers.
The idea in plain language
In a classic database server, the engine and its data files live together. A standby is a second server with a second copy of the files, kept in sync by shipping logs.
Aurora splits the two:
- Compute: one writer instance and up to 15 reader instances, running a PostgreSQL- or MySQL-compatible engine.
- Storage: one cluster volume. It is a distributed storage service that keeps six copies of your data across three Availability Zones. It grows automatically, and you pay only for what you use. The maximum size is 128 TiB, or 256 TiB on specific engine versions.
All instances read the same volume. Adding a reader doesn't copy your data, so it's fast. If the writer dies, a reader is promoted, and because it already sees the same storage, there is no data to catch up on. Service is typically restored in less than 60 seconds, often less than 30.
Analogy: A traditional database with a standby is two bank branches, each with its own vault, and a courier van carrying copies of every ledger page between them. Aurora is several tellers' windows all opening onto one shared, triple-protected vault. If a teller falls ill, the next teller steps up to the same vault. Nothing has to be carried across town first.
What problem Aurora solves
| Need | How Aurora meets it | Sharp edge |
|---|---|---|
| Faster failover than single-standby replication | Readers share storage; promotion doesn't copy data | Clients must reconnect; DNS caching can stretch the outage (see RDS Proxy in the pooling lesson) |
| Read scaling | Up to 15 readers behind one reader endpoint | Replicas are asynchronous: a read right after a write may not see it |
| Storage that never runs out | Auto-growing volume; space is freed when you drop data | Storage and I/O pricing differ from RDS |
| Variable load | Serverless v2: capacity in ACUs, scales in steps as small as 0.5 ACU, down to 0 with auto-pause | A cluster at minimum capacity may be slow on the first queries; resuming from 0 takes time |
| Cross-Region DR | Global Database: storage-level replication to up to 10 secondary Regions, typically under 1 s lag | One writer Region; Secrets Manager integration not supported on global databases |
| Fast copies for testing | Cloning: copy-on-write clone of the volume | Clones share pages until changed; keep data classification in mind |
Aurora Serverless v2 in one table
| Property | Value (checked 2026-11-18) |
|---|---|
| Capacity unit | ACU ≈ 2 GiB memory + matching CPU and networking |
| Range | 0–256 ACU (Aurora MySQL); 0–384 ACU (Aurora PostgreSQL on recent versions and platform version 4) |
| Minimum 0 (auto-pause) | Aurora PostgreSQL 13.15+, 14.12+, 15.7+, 16.3+, 17.4+, 18.3+; Aurora MySQL 3.08+ |
| Scaling step | As small as 0.5 ACU, larger steps at higher capacity; no disruption to open connections or transactions |
| Billing | ACU-hours, measured per second |
| Mixed clusters | Serverless and provisioned instances can share a cluster |
| Free plan | Aurora PostgreSQL Serverless up to 4 ACU and 1 GiB storage per cluster (accounts created after 2025-07-15) |
Readers in promotion tiers 0–1 scale with the writer, so they are always big enough to take over. Readers in tiers 2–15 scale independently, which suits a reporting reader that can sleep at night.
Storage configurations
- Aurora Standard: you pay per GB-month of storage plus per million I/O requests. Best when I/O is under about 25% of your Aurora bill.
- Aurora I/O-Optimized: no I/O charges, higher compute and storage rates. Best when I/O is 25% or more of the bill. You can switch from Standard to I/O-Optimized once every 30 days, and back at any time.
Endpoints
| Endpoint | Points to | Use it for |
|---|---|---|
| Cluster (writer) endpoint | The current writer | All writes, DDL, read-your-writes reads |
| Reader endpoint | Load-balanced across readers | Read-only queries that tolerate replica lag |
| Custom endpoint | A subset of instances you choose | For example a big reporting reader |
| Instance endpoint | One specific instance | Diagnosis only; doesn't follow failover |
| Global writer endpoint | Writer of the current primary Region | Global Database; follows cross-Region switchover |
Where Aurora DSQL fits
Amazon Aurora DSQL (generally available since May 2025) is a different product that shares the Aurora name. It is a serverless, distributed SQL database with PostgreSQL compatibility, designed for active-active writes across Regions with strong consistency. It authenticates with IAM and has no instances to size.
The catch is compatibility. DSQL supports a subset of PostgreSQL features, expressions and data types, and it uses optimistic concurrency, so conflicting transactions fail at commit and must be retried by the client. Consider it only when a workload truly needs multi-Region writes and you have checked every feature you depend on. For a classic ledger with one writer Region, Aurora PostgreSQL with Global Database is the conservative choice.
Microsoft / Azure comparison
| You know (Microsoft/Azure) | AWS equivalent | What's different |
|---|---|---|
| Azure SQL Hyperscale (shared page servers) | Aurora cluster volume | Similar idea; Aurora engines are PostgreSQL/MySQL, not SQL Server |
| Always On AG listener | Cluster (writer) endpoint | DNS-based; the endpoint name stays the same across failover |
| Read-only routing to AG secondaries | Reader endpoint | Load-balanced connections, not per-query routing |
| Azure SQL serverless (auto-pause) | Aurora Serverless v2 with 0 ACU minimum | Scales each instance continuously; pause/resume behaviour differs |
| Active geo-replication / failover groups | Aurora Global Database | Storage-level replication; managed switchover and failover |
| Database copy for testing | Aurora clone (copy-on-write) | Near-instant, no full copy |
| Babelfish | (no Azure equivalent) | T-SQL over TDS on Aurora PostgreSQL (comparison lesson) |
Architecture
Security-boundary view.
- Every instance lives in private subnets. Security groups admit only application security groups.
- The cluster volume is encrypted with a customer managed KMS key, and so are backups, snapshots and clones.
- For Global Database, each secondary Region needs its own KMS key in that Region (KMS keys are Regional), and its own network and IAM setup.
- Writes travel only to the primary Region's writer. If you enable write forwarding, secondary clusters send writes to the primary over AWS's network. Your audit trail must show which Region accepted each request.
Step-by-step implementation
You'll create a small Aurora PostgreSQL Serverless v2 cluster (one writer, one reader), connect from .NET through both endpoints, trigger a failover and measure it, then delete everything. Budget about one hour.
Prepare network and key
Reuse the DB subnet group and KMS key pattern from the RDS lesson. You need private subnets in at least two AZs (three is better for Aurora) and a security group that admits 5432 from your bastion or CloudShell environment's security group.
Create a cluster parameter group
Aurora has two parameter levels:
- DB cluster parameter group: settings that apply to every instance, for example
rds.force_ssl. - DB parameter group: per-instance settings.
Create a cluster parameter group for family aurora-postgresql16 (or 17), and set rds.force_ssl = 1.
Create the cluster and its instances
In Aurora, the cluster holds storage, endpoints, backups and the master secret. Instances are compute attached to it. You create the cluster first, then a writer instance and a reader instance, both with class db.serverless.
Connect through both endpoints
Run the failover stopwatch (Complete code below) from inside the VPC with HL_WRITER set to the cluster endpoint and HL_READER set to the reader endpoint. You'll see heartbeats being written, and the reader reporting how stale its newest heartbeat is (typically milliseconds).
Fail over and measure
While the stopwatch runs, call aws rds failover-db-cluster. Watch the writes fail, then come back on a new writer IP. Record the outage seconds. That number is your measured failover time, which is better than a quoted one.
Clean up
Delete both instances, then the cluster (skip the final snapshot for the lab), then the parameter group, and schedule the KMS key for deletion if it was lab-only.
AWS Console instructions
- Console → RDS → Parameter groups → Create parameter group: family
aurora-postgresql16, type DB Cluster Parameter Group, namehl-m06-l4-cluster. Edit it, setrds.force_sslto1, and save. - Console → RDS → Create database → Standard create → Aurora (PostgreSQL Compatible):
- Engine version: a version that supports a 0 ACU minimum (for example 16.3 or later).
- Templates: Dev/Test. DB cluster identifier:
hl-m06-l4. Credentials management: Managed in AWS Secrets Manager, encrypted with your KMS key. - Cluster storage configuration: Aurora Standard.
- Instance configuration: Serverless v2, minimum 0 ACUs, maximum 2 ACUs. Availability & durability: Create an Aurora Replica or Reader node in a different AZ.
- Connectivity: your VPC, the private DB subnet group, Public access: No, security group
hl-m06-l4-db. - Additional configuration: initial database
ledger; DB cluster parameter grouphl-m06-l4-cluster; backup retention 1 day; encryption with your KMS key; deletion protection off. - Database authentication: enable IAM database authentication.
- Tags
Project=cea-lab,Lab=m06-l4,Environment=learn,Owner=<you>.
- After creation, open the cluster and look at the Connectivity & security tab: you'll see the writer and reader endpoints. Under Configuration, find the promotion tier of each instance.
- To fail over: select the cluster, then Actions → Failover.
AWS CLI
PROFILE=learn-sandbox; REGION=us-east-1
TAGS='Key=Project,Value=cea-lab Key=Lab,Value=m06-l4 Key=Environment,Value=learn Key=Owner,Value=your-name'
# Which Aurora PostgreSQL versions exist here? Pick one that supports 0 ACU (see the table above).
aws rds describe-db-engine-versions --engine aurora-postgresql \
--query "DBEngineVersions[].EngineVersion" --output text --profile $PROFILE --region $REGION
# 1. Cluster parameter group forcing TLS
aws rds create-db-cluster-parameter-group --db-cluster-parameter-group-name hl-m06-l4-cluster \
--db-parameter-group-family aurora-postgresql16 --description "m06 l4" --tags $TAGS \
--profile $PROFILE --region $REGION
aws rds modify-db-cluster-parameter-group --db-cluster-parameter-group-name hl-m06-l4-cluster \
--parameters "ParameterName=rds.force_ssl,ParameterValue=1,ApplyMethod=pending-reboot" \
--profile $PROFILE --region $REGION
# 2. The cluster: storage, endpoints, backups, master secret. Serverless v2 range 0-2 ACU.
aws rds create-db-cluster \
--db-cluster-identifier hl-m06-l4 \
--engine aurora-postgresql --engine-version 16.6 \
--serverless-v2-scaling-configuration MinCapacity=0,MaxCapacity=2,SecondsUntilAutoPause=600 \
--storage-encrypted --kms-key-id "$KEY_ARN" \
--master-username ledger_admin --manage-master-user-password --master-user-secret-kms-key-id "$KEY_ARN" \
--database-name ledger \
--db-subnet-group-name hl-m06-l3 --vpc-security-group-ids "$SG_ID" \
--db-cluster-parameter-group-name hl-m06-l4-cluster \
--enable-iam-database-authentication \
--backup-retention-period 1 --copy-tags-to-snapshot --no-deletion-protection \
--tags $TAGS --profile $PROFILE --region $REGION
# 3. Writer (tier 0) and reader (tier 1) instances, both Serverless v2
aws rds create-db-instance --db-instance-identifier hl-m06-l4-a --db-cluster-identifier hl-m06-l4 \
--engine aurora-postgresql --db-instance-class db.serverless --promotion-tier 0 \
--no-publicly-accessible --tags $TAGS --profile $PROFILE --region $REGION
aws rds create-db-instance --db-instance-identifier hl-m06-l4-b --db-cluster-identifier hl-m06-l4 \
--engine aurora-postgresql --db-instance-class db.serverless --promotion-tier 1 \
--no-publicly-accessible --tags $TAGS --profile $PROFILE --region $REGION
aws rds wait db-instance-available --db-instance-identifier hl-m06-l4-b --profile $PROFILE --region $REGION
# 4. Endpoints and roles
aws rds describe-db-clusters --db-cluster-identifier hl-m06-l4 \
--query "DBClusters[0].{Writer:Endpoint,Reader:ReaderEndpoint,Members:DBClusterMembers[].{Id:DBInstanceIdentifier,Writer:IsClusterWriter,Tier:PromotionTier}}" \
--profile $PROFILE --region $REGION
# 5. Fail over to the reader (run the stopwatch first!)
aws rds failover-db-cluster --db-cluster-identifier hl-m06-l4 \
--target-db-instance-identifier hl-m06-l4-b --profile $PROFILE --region $REGION
# 6. Clone the cluster (copy-on-write) - e.g. for a test environment. Delete it straight away in the lab.
aws rds restore-db-cluster-to-point-in-time --source-db-cluster-identifier hl-m06-l4 \
--db-cluster-identifier hl-m06-l4-clone --restore-type copy-on-write --use-latest-restorable-time \
--db-subnet-group-name hl-m06-l3 --vpc-security-group-ids "$SG_ID" --tags $TAGS \
--profile $PROFILE --region $REGION--engine-version 16.6 is an example. Use a version from the first command that is listed as supporting a 0 ACU minimum ⚠ VERIFY. If SecondsUntilAutoPause is rejected by your CLI version, omit it to use the default. A clone has no instances until you add one, and you pay only for changed pages and any instances you attach.
Infrastructure as Code
using Amazon.CDK;
using Amazon.CDK.AWS.EC2;
using Amazon.CDK.AWS.KMS;
using Amazon.CDK.AWS.RDS;
using Constructs;
public sealed class AuroraLedgerStack : Stack
{
public AuroraLedgerStack(Construct scope, string id, IVpc vpc, IStackProps? props = null) : base(scope, id, props)
{
var key = new Key(this, "Key", new KeyProps { EnableKeyRotation = true, Alias = "alias/hl-m06-l4" });
var engine = DatabaseClusterEngine.AuroraPostgres(new AuroraPostgresClusterEngineProps
{
Version = AuroraPostgresEngineVersion.VER_16_6, // pick a version that supports 0 ACU ⚠ VERIFY
});
var cluster = new DatabaseCluster(this, "Ledger", new DatabaseClusterProps
{
ClusterIdentifier = "hl-m06-l4",
Engine = engine,
Writer = ClusterInstance.ServerlessV2("writer", new ServerlessV2ClusterInstanceProps { PubliclyAccessible = false }),
Readers = new[]
{
// Tier 0-1 readers scale with the writer, so they can take over without a cold start.
ClusterInstance.ServerlessV2("reader", new ServerlessV2ClusterInstanceProps { ScaleWithWriter = true }),
},
ServerlessV2MinCapacity = 0,
ServerlessV2MaxCapacity = 2,
Vpc = vpc,
VpcSubnets = new SubnetSelection { SubnetType = SubnetType.PRIVATE_ISOLATED },
StorageEncrypted = true,
StorageEncryptionKey = key,
Credentials = Credentials.FromGeneratedSecret("ledger_admin", new CredentialsBaseOptions { EncryptionKey = key }),
DefaultDatabaseName = "ledger",
IamAuthentication = true,
ParameterGroup = new ParameterGroup(this, "ClusterParams", new ParameterGroupProps
{
Engine = engine,
Parameters = new Dictionary<string, string> { ["rds.force_ssl"] = "1" },
}),
Backup = new BackupProps { Retention = Duration.Days(1) }, // production: 7-35
DeletionProtection = false, // production: true
RemovalPolicy = RemovalPolicy.DESTROY, // ⚠ lab only
});
Amazon.CDK.Tags.Of(this).Add("Project", "cea-lab");
Amazon.CDK.Tags.Of(this).Add("Lab", "m06-l4");
_ = new CfnOutput(this, "WriterEndpoint", new CfnOutputProps { Value = cluster.ClusterEndpoint.Hostname });
_ = new CfnOutput(this, "ReaderEndpoint", new CfnOutputProps { Value = cluster.ClusterReadEndpoint.Hostname });
}
}Complete code
The failover stopwatch writes a heartbeat row every 200 ms through the writer endpoint, and every 5 seconds reports how stale the reader endpoint's view is. When you trigger a failover, it prints the exact write outage. It runs against local PostgreSQL too (no failover, but you can test it), so you can build it for free first.
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net10.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Npgsql" Version="10.0.3" />
</ItemGroup>
</Project>using System.Diagnostics;
using Npgsql;
// Failover stopwatch: writes a heartbeat row every 200 ms through the Aurora CLUSTER (writer)
// endpoint and reads through the READER endpoint, and reports how long writes were unavailable
// while you run `aws rds failover-db-cluster`. Works against local PostgreSQL too (no failover).
//
// Env vars:
// HL_WRITER e.g. Host=hl-m06-l4.cluster-abc.us-east-1.rds.amazonaws.com;Database=ledger;Username=ledger_admin;Password=...;SSL Mode=VerifyFull;Root Certificate=global-bundle.pem
// HL_READER same, with the cluster-ro endpoint (optional)
// Ctrl+C to stop and print the summary.
var writerCs = Environment.GetEnvironmentVariable("HL_WRITER") ?? throw new InvalidOperationException("Set HL_WRITER.");
var readerCs = Environment.GetEnvironmentVariable("HL_READER");
// Short timeouts so a dead endpoint is noticed quickly; short pool lifetime so the pool doesn't keep
// handing out connections to the old writer after DNS has moved to the new one.
static NpgsqlDataSource Build(string cs) => new NpgsqlDataSourceBuilder(new NpgsqlConnectionStringBuilder(cs)
{
Timeout = 3,
CommandTimeout = 3,
ConnectionLifetime = 30,
MaxPoolSize = 5,
ApplicationName = "hl-failover-stopwatch",
}.ConnectionString).Build();
await using var writer = Build(writerCs);
await using var reader = readerCs is null ? null : Build(readerCs);
await using (var setup = writer.CreateCommand(
"CREATE TABLE IF NOT EXISTS failover_heartbeat (id bigserial PRIMARY KEY, at timestamptz NOT NULL DEFAULT now(), writer_ip inet)"))
{
await setup.ExecuteNonQueryAsync();
}
using var cts = new CancellationTokenSource();
Console.CancelKeyPress += (_, e) => { e.Cancel = true; cts.Cancel(); };
var outageStart = (DateTimeOffset?)null;
var outages = new List<TimeSpan>();
string? lastWriterIp = null;
var sw = Stopwatch.StartNew();
while (!cts.IsCancellationRequested)
{
try
{
await using var cmd = writer.CreateCommand(
"INSERT INTO failover_heartbeat (writer_ip) VALUES (inet_server_addr()) RETURNING host(inet_server_addr())");
var ip = (string?)await cmd.ExecuteScalarAsync(cts.Token);
if (outageStart is { } started)
{
var gap = DateTimeOffset.UtcNow - started;
outages.Add(gap);
Console.WriteLine($"{DateTimeOffset.UtcNow:HH:mm:ss.fff} WRITES BACK after {gap.TotalSeconds:F1}s (writer {ip})");
outageStart = null;
}
else if (ip != lastWriterIp)
{
Console.WriteLine($"{DateTimeOffset.UtcNow:HH:mm:ss.fff} writer is {ip}");
}
lastWriterIp = ip;
if (reader is not null && sw.Elapsed.TotalSeconds >= 5)
{
await using var lag = reader.CreateCommand("SELECT now() - max(at) FROM failover_heartbeat");
var behind = await lag.ExecuteScalarAsync(cts.Token);
Console.WriteLine($"{DateTimeOffset.UtcNow:HH:mm:ss.fff} reader sees newest heartbeat {behind} old");
sw.Restart();
}
}
catch (Exception ex) when (ex is NpgsqlException or TimeoutException or System.Net.Sockets.SocketException && !cts.IsCancellationRequested)
{
if (outageStart is null)
{
outageStart = DateTimeOffset.UtcNow;
Console.WriteLine($"{DateTimeOffset.UtcNow:HH:mm:ss.fff} WRITE FAILED: {ex.GetType().Name}: {ex.Message}");
}
// A failed physical connection is discarded by the pool; clear the rest so we re-resolve DNS.
NpgsqlConnection.ClearAllPools();
}
catch (OperationCanceledException)
{
break;
}
try
{
await Task.Delay(200, cts.Token);
}
catch (OperationCanceledException)
{
break;
}
}
Console.WriteLine();
Console.WriteLine(outages.Count == 0
? "No write outage observed."
: $"Write outages: {string.Join(", ", outages.Select(o => $"{o.TotalSeconds:F1}s"))}");Typical output during a failover (fictional run):
14:02:10.114 writer is 10.20.11.37
14:02:15.322 reader sees newest heartbeat 00:00:00.018 old
14:02:31.905 WRITE FAILED: NpgsqlException: Exception while reading from stream
14:02:52.460 WRITES BACK after 20.6s (writer 10.20.12.84)
^C
Write outages: 20.6sCode explained line by line
HL_WRITERandHL_READERcome from environment variables, so no connection string is committed to source control. In the lab you paste the password from Secrets Manager into your session only, or use IAM authentication (see Encryption and access).Build(...): setsTimeout = 3(connect) andCommandTimeout = 3, so a dead writer is detected in seconds, not in the default 15–30 seconds.ConnectionLifetime = 30: retires pooled physical connections after 30 seconds. After failover the cluster endpoint's DNS points at a new IP, and long-lived pooled connections would otherwise keep trying the old one.CREATE TABLE IF NOT EXISTS failover_heartbeat: a tiny table.inet_server_addr()returns the IP of the server that handled the statement, so you can see the writer change.Console.CancelKeyPress: Ctrl+C stops the loop cleanly and prints the summary.- The
INSERT ... RETURNING host(inet_server_addr()): one round trip that both proves the write landed and tells you where. if (outageStart is { } started): the first successful write after a failure closes the outage window and records its length.- The reader query
now() - max(at): approximate replica lag as seen by the application, the number that matters for "can I read my own write from the reader?". catch (... when ...): only database, timeout and socket failures count as an outage. Cancellation is handled separately.NpgsqlConnection.ClearAllPools(): drops every idle pooled connection, so the next attempt resolves DNS again. Production code should rely on short lifetimes plus retries (EF Core's execution strategy, covered in EF Core on AWS), or on RDS Proxy, rather than clearing pools by hand.- The final summary is your evidence for the failover test in the operational resilience file.
Security considerations
- Same baseline as RDS: private subnets, CMK encryption chosen at creation,
rds.force_ssl=1, RDS-managed master secret, IAM database authentication for apps, CloudTrail for control-plane changes. - Clones are copies of production data. A copy-on-write clone of the ledger holds real customer data, even if it shares pages. Never clone production into a lower environment unless the data is masked. Use synthetic data (as this course does) for test environments.
- Global Database means data in more than one Region. Under UK GDPR that is fine within adequate jurisdictions, but data residency rules, customer contracts and your DPO must agree with the secondary Region choice. Each Region needs its own KMS key.
- Secrets Manager integration (RDS-managed master password) is not supported for Aurora Global Database. You must turn it off before adding a Region, and manage the master credentials yourself, ideally with a rotation Lambda.
- Write forwarding lets secondary Regions accept writes. Treat it as an application-level security decision: log the Region, and limit which services may write from secondaries.
⚠ Learning shortcut — not for production
The lab cluster uses a 1-day backup retention, no deletion protection, deletes without a final snapshot and connects with the master user from the stopwatch. In production, the stopwatch (or any synthetic monitor) uses a dedicated low-privilege user with INSERT on one heartbeat table. Retention is 7–35 days plus AWS Backup copies, and deletion protection is on.
Banking use case
Harbourline's architecture board compares two designs for the ledger (fictional figures):
| Requirement | RDS for PostgreSQL Multi-AZ | Aurora PostgreSQL (writer + tier-0 reader) + Global Database |
|---|---|---|
| In-Region failover | Measured 60–120 s including client DNS | Measured 15–30 s with short pool lifetimes; less with RDS Proxy |
| Read scaling for statements | Read replicas (async, separate storage) | Reader endpoint, shared storage |
| Region loss | Cross-Region read replica, manual promotion, RPO = replica lag | Global Database managed failover, typically sub-second lag |
| Cost (relative) | 1.0× | About 1.6× for the primary Region, plus the secondary Region ⚠ VERIFY with the Pricing Calculator |
Decision: Aurora PostgreSQL for the ledger (impact tolerance for payments: 5 minutes, measured failover well inside it). Global Database with a secondary Region, running small Serverless v2 readers that scale up on promotion. A quarterly switchover drill rotates the primary Region and back, with the stopwatch's output filed as evidence.
Onboarding drafts and branch rota stay on RDS for PostgreSQL: the extra resilience isn't worth the cost there.
Common mistakes
- Connecting applications to instance endpoints. They don't follow failover. Use the cluster and reader endpoints.
- Reading your own write from the reader endpoint. Replication to readers is asynchronous. After posting a payment, read the balance from the writer.
- Long-lived pooled connections with long DNS caching. After failover the app keeps hitting the old writer. Use short connection lifetimes and retries, or RDS Proxy.
- Setting Serverless v2 minimum to 0 for a latency-sensitive workload. Resuming from pause takes time. Use a minimum that keeps the working set in memory.
- All instances in one AZ. Shared storage survives an AZ loss, but your compute doesn't. Spread writer and readers across AZs.
- Ignoring I/O charges. I/O-heavy workloads on Aurora Standard can cost more than expected. Check whether I/O-Optimized is cheaper.
- Assuming Global Database is active-active. There is one writer Region. Write forwarding forwards; it doesn't multi-master. For multi-Region writes, look at Aurora DSQL or DynamoDB global tables.
Troubleshooting
| Symptom | Likely cause | Fix |
|---|---|---|
| App errors for minutes after failover | Stale DNS or pooled connections to the old writer | Short Connection Lifetime, retries, RDS Proxy |
cannot execute INSERT in a read-only transaction | Connected to the reader endpoint, or a just-demoted instance | Use the cluster endpoint for writes; reconnect after failover |
| First query after idle takes seconds | Serverless v2 paused at 0 ACU | Raise minimum capacity, or accept for dev/test |
ServerlessDatabaseCapacity pinned at maximum | Max ACU too low, or a bad query | Raise max; tune queries (see performance optimisation) |
| Can't add a Region to a global database | Secrets Manager integration enabled, or unsupported version/class | Turn off RDS-managed secret; check version support |
| Unexpected storage bill | I/O charges on Standard, or clones and snapshots retained | Compare I/O-Optimized; delete clones and old snapshots |
Cost and cleanup
- Free plan accounts: Aurora PostgreSQL Serverless is included up to 4 ACU and 1 GiB storage per cluster. The lab's 0–2 ACU range fits.
- Paid plan: Serverless v2 is billed per ACU-hour (around USD 0.12 per ACU-hour in us-east-1 on Aurora Standard ⚠ VERIFY). Two instances at 0.5–2 ACU for an hour cost roughly USD 0.20–0.50, plus storage and I/O cents, the KMS key (USD 1/month pro-rated) and the secret (USD 0.40/month pro-rated). With auto-pause at 0 ACU, idle instances don't accrue ACU charges.
Teardown:
PROFILE=learn-sandbox; REGION=us-east-1
# Clone first (if you created it): delete its instances (none by default), then the cluster
aws rds delete-db-cluster --db-cluster-identifier hl-m06-l4-clone --skip-final-snapshot --profile $PROFILE --region $REGION
# Instances, then the cluster
aws rds delete-db-instance --db-instance-identifier hl-m06-l4-b --profile $PROFILE --region $REGION
aws rds delete-db-instance --db-instance-identifier hl-m06-l4-a --profile $PROFILE --region $REGION
aws rds wait db-instance-deleted --db-instance-identifier hl-m06-l4-a --profile $PROFILE --region $REGION
aws rds delete-db-cluster --db-cluster-identifier hl-m06-l4 --skip-final-snapshot --profile $PROFILE --region $REGION
aws rds wait db-cluster-deleted --db-cluster-identifier hl-m06-l4 --profile $PROFILE --region $REGION 2>/dev/null || sleep 120
aws rds delete-db-cluster-parameter-group --db-cluster-parameter-group-name hl-m06-l4-cluster --profile $PROFILE --region $REGION
# Verify
aws rds describe-db-clusters --query "DBClusters[?starts_with(DBClusterIdentifier,'hl-m06')].DBClusterIdentifier" --profile $PROFILE --region $REGION
aws rds describe-db-cluster-snapshots --snapshot-type manual --query "DBClusterSnapshots[?starts_with(DBClusterSnapshotIdentifier,'hl-m06')]" --profile $PROFILE --region $REGION
aws resourcegroupstaggingapi get-resources --tag-filters Key=Lab,Values=m06-l4 --query "ResourceTagMappingList[].ResourceARN" --profile $PROFILE --region $REGIONIf your CLI has no db-cluster-deleted waiter, the fallback sleep gives deletion time before the parameter group is removed.
Free alternative: run the stopwatch against local PostgreSQL (docker compose up -d in labs/m06-banking-data-store, then set HL_WRITER). Simulate a failover with docker restart on the container and measure the outage. The mechanics of detection, pool clearing and reconnect are the same.
Exercises
- 🟢 Guided: Run the stopwatch locally against Docker PostgreSQL, then restart the container (
docker restart <name>) and record the outage. Then, if you have credits, repeat against the Aurora lab cluster withfailover-db-cluster. - 🟡 Challenge: Change the stopwatch to use Npgsql's multi-host support. Put both instance endpoints in
Host=, setTarget Session Attributes=read-writefor the writer data source andprefer-standbyfor the reader. Compare failover detection with the cluster endpoint approach. Which do you prefer for production, and why? - 🔴 Live problem: "Risk wants the ledger to survive the loss of us-east-1 with RPO under 5 seconds and RTO under 15 minutes, and asks whether we can also 'write in both Regions to be safe'. Budget is tight." Write a one-page design response.
Assignment
Add docs/failover-test-<date>.md to your portfolio repository. Include the setup (engine version, instance classes, AZs), the exact commands, the stopwatch output from at least two failovers, your measured RTO, and one change you would make to reduce it.
Solutions
Locally, docker restart typically gives an outage of a few seconds: the container stops, the pool's connections fail, ClearAllPools() forces new connections, and they succeed once PostgreSQL accepts connections again. On Aurora, expect roughly 15–40 seconds with this client setup (AWS states service is typically restored in under 60 seconds, often under 30).
Why the difference: Aurora must detect the failure, promote the reader and update DNS for the cluster endpoint. The client then has to notice, discard pooled connections and re-resolve the name. Your measurement includes all of that, which is why it's more honest than a quoted figure.
var multiHost = new NpgsqlDataSourceBuilder(
"Host=hl-m06-l4-a.xxxx.us-east-1.rds.amazonaws.com,hl-m06-l4-b.xxxx.us-east-1.rds.amazonaws.com;" +
"Database=ledger;Username=ledger_admin;Password=...;SSL Mode=VerifyFull;Root Certificate=global-bundle.pem")
.BuildMultiHost();
await using var writer = multiHost.WithTargetSession(TargetSessionAttributes.ReadWrite);
await using var reader = multiHost.WithTargetSession(TargetSessionAttributes.PreferStandby);Npgsql checks each host's role and picks one that matches, so after failover it finds the new writer without waiting for DNS. Trade-off: you now hard-code instance endpoints. Adding a reader or replacing an instance means a config change, and instance endpoints don't follow cluster topology automatically. For production, most teams prefer the cluster/reader endpoints plus short connection lifetimes, or RDS Proxy, which tracks the writer for you. Multi-host is useful when you need the fastest possible client-side detection.
- RPO under 5 s across Regions: Aurora Global Database replicates at the storage layer with typical lag under a second. For Aurora PostgreSQL you can also manage an RPO target (the global database RPO feature ⚠ VERIFY parameter name and behaviour). Monitor replication lag with CloudWatch and alarm well below 5 s.
- RTO under 15 minutes: use managed cross-Region failover (unplanned) on the global database, a pre-provisioned secondary with at least one Serverless v2 reader, application stacks deployed in both Regions, and the global writer endpoint so connection strings don't change. Rehearse quarterly with planned switchovers.
- "Write in both Regions": Global Database has a single writer Region. Write forwarding only forwards writes to it, so it doesn't survive loss of the primary for writes. True multi-Region writes for a ledger mean Aurora DSQL or DynamoDB global tables. Both bring conflict and consistency trade-offs that a ledger rarely wants. Recommend single-writer plus fast failover.
- Budget: secondary readers on Serverless v2 with a low minimum; I/O-Optimized only if I/O dominates. Present the cost alongside the impact tolerance it buys.
Knowledge check
Answer: Readers share the same cluster volume as the writer, so promoting one needs no data copy or log catch-up at the storage level. AWS states service is typically restored in less than 60 seconds, often less than 30. Without any reader, Aurora must recover the primary host, which typically takes under 10 minutes.
Answer: Six copies across three Availability Zones in the Region, regardless of how many instances you run.
Answer: The cluster (writer) endpoint. Readers are updated asynchronously and might not yet show the write.
Answer: The instance can pause when idle (auto-pause) and costs no ACU-hours while paused. It is a bad idea for latency-sensitive production workloads, because resuming takes time and the buffer cache starts cold.
Answer: Switchover is planned: it moves the primary role to a healthy secondary with no data loss (for example, a Region rotation drill). Failover is for recovering from an outage in the primary Region: it promotes a secondary, and some recent writes may be lost up to the replication lag.
Interview questions
- "When would you choose Aurora over RDS for PostgreSQL?" When failover time, read scaling on shared storage, fast cloning or cross-Region DR with Global Database justify the higher price. For small or non-critical databases, RDS is usually enough.
- "How do you make a .NET app survive an Aurora failover gracefully?" Use the cluster endpoint, short connection lifetimes, sensible timeouts, a retrying execution strategy with idempotent units of work, and optionally RDS Proxy. Test it with a real failover and measure.
- "Explain Aurora I/O-Optimized." A storage configuration with no per-I/O charges but higher instance and storage rates. It pays off when I/O is roughly a quarter or more of Aurora spend. You can switch from Standard once every 30 days.
- "Global Database or DynamoDB global tables for a multi-Region ledger?" Global Database keeps relational semantics with one writer Region and fast failover. Global tables give multi-Region writes with last-writer-wins conflict resolution, which is dangerous for balances unless you design around it. For a ledger I'd usually choose a single writer.
Certification practice
A bank runs its transaction database on Amazon Aurora PostgreSQL in one AWS Region. It needs a disaster recovery solution with an RPO of seconds and an RTO of minutes if the Region becomes unavailable. Which solution meets these requirements?
A. Take hourly snapshots and copy them to a second Region B. Configure Aurora Global Database with a secondary cluster in a second Region C. Create a cross-Region read replica of each Aurora instance D. Enable Multi-AZ on the Aurora cluster
Answer: B. Global Database replicates at the storage layer with typically sub-second lag and supports managed cross-Region failover. A gives an RPO of up to an hour and a slow restore. C isn't how Aurora replicates across Regions at storage level, and it gives weaker RPO/RTO. D protects against AZ failure only.
An application on Amazon Aurora MySQL has heavy read traffic for reports, which slows down transactions. Reports can be a few seconds stale. What should a solutions architect do with the LEAST application change?
A. Add Aurora Replicas and point the reporting module at the reader endpoint B. Increase the writer instance size C. Move reports to an Amazon ElastiCache cluster D. Enable Aurora I/O-Optimized
Answer: A. Readers share storage and are load-balanced behind the reader endpoint, and reports tolerate a little lag. B treats the symptom at higher cost. C needs a caching design. D changes pricing, not read capacity.
After an Aurora failover, a .NET service keeps getting errors for several minutes, although the new writer is available within 30 seconds. The service uses a connection pool with connections that live for hours. What is the MOST likely fix?
A. Increase the maximum pool size B. Reduce the pooled connection lifetime and add retry logic for transient errors C. Connect to the instance endpoint of the writer D. Disable TLS to speed up reconnection
Answer: B. Long-lived pooled connections keep pointing at the old writer. Short lifetimes force reconnection through the updated cluster endpoint, and retries cover the gap. A makes more stale connections. C breaks on the next failover. D weakens security and doesn't address the cause.
Completion checklist
- I can draw Aurora's compute/storage split and name the endpoint types
- I ran the failover stopwatch (locally or on Aurora) and recorded a measured outage
- I can explain Serverless v2 capacity, auto-pause and promotion tiers
- I can explain Global Database switchover vs failover and its main limits
- I deleted the cluster, instances, clone and parameter group, and verified with the CLI
Key takeaways
- Aurora separates compute (writer + up to 15 readers) from a shared cluster volume with six copies across three AZs.
- Failover is fast because no data moves, but clients must reconnect. Short pool lifetimes, retries or RDS Proxy turn 30 seconds of database failover into 30 seconds of app impact, not 3 minutes.
- Serverless v2 scales in ACUs, down to 0 with auto-pause on recent versions. Keep the minimum high enough for latency-sensitive work.
- Global Database gives one writer Region with storage-level replication to up to 10 secondaries. Rehearse switchovers; plan failovers.
- Measure failover and replica lag yourself, and file the evidence.
Further reading
Independent learning resource — not affiliated with, endorsed or sponsored by Amazon Web Services. AWS and related marks are trademarks of Amazon.com, Inc. or its affiliates. All banking data in examples is fictional. Sample architectures are for learning and are not automatically compliant with GDPR, PCI DSS or any banking regulation.
Amazon RDS for SQL Server and PostgreSQL
Create and operate an RDS instance like a bank would: pick the engine, edition and licence model, size instance and gp3 storage, manage parameter and option groups, plan maintenance windows and upgrades, and audit every instance's posture from C#.
Multi-AZ, read replicas, backups and point-in-time recovery
Know exactly what Multi-AZ instances, Multi-AZ DB clusters, read replicas, automated backups, snapshots and point-in-time restore protect against, map them to RPO and RTO, and run a repeatable, evidenced restore drill from C#.