Skip to Content
Cloud Engineering Academy
6. Databases & Data Architecture

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.

intermediate⏱ 2 h 🟡 Low costSAA-C03DEA-C01DVA-C03

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

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

NeedHow Aurora meets itSharp edge
Faster failover than single-standby replicationReaders share storage; promotion doesn't copy dataClients must reconnect; DNS caching can stretch the outage (see RDS Proxy in the pooling lesson)
Read scalingUp to 15 readers behind one reader endpointReplicas are asynchronous: a read right after a write may not see it
Storage that never runs outAuto-growing volume; space is freed when you drop dataStorage and I/O pricing differ from RDS
Variable loadServerless v2: capacity in ACUs, scales in steps as small as 0.5 ACU, down to 0 with auto-pauseA cluster at minimum capacity may be slow on the first queries; resuming from 0 takes time
Cross-Region DRGlobal Database: storage-level replication to up to 10 secondary Regions, typically under 1 s lagOne writer Region; Secrets Manager integration not supported on global databases
Fast copies for testingCloning: copy-on-write clone of the volumeClones share pages until changed; keep data classification in mind

Aurora Serverless v2 in one table

PropertyValue (checked 2026-11-18)
Capacity unitACU ≈ 2 GiB memory + matching CPU and networking
Range0–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 stepAs small as 0.5 ACU, larger steps at higher capacity; no disruption to open connections or transactions
BillingACU-hours, measured per second
Mixed clustersServerless and provisioned instances can share a cluster
Free planAurora 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

EndpointPoints toUse it for
Cluster (writer) endpointThe current writerAll writes, DDL, read-your-writes reads
Reader endpointLoad-balanced across readersRead-only queries that tolerate replica lag
Custom endpointA subset of instances you chooseFor example a big reporting reader
Instance endpointOne specific instanceDiagnosis only; doesn't follow failover
Global writer endpointWriter of the current primary RegionGlobal 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 equivalentWhat's different
Azure SQL Hyperscale (shared page servers)Aurora cluster volumeSimilar idea; Aurora engines are PostgreSQL/MySQL, not SQL Server
Always On AG listenerCluster (writer) endpointDNS-based; the endpoint name stays the same across failover
Read-only routing to AG secondariesReader endpointLoad-balanced connections, not per-query routing
Azure SQL serverless (auto-pause)Aurora Serverless v2 with 0 ACU minimumScales each instance continuously; pause/resume behaviour differs
Active geo-replication / failover groupsAurora Global DatabaseStorage-level replication; managed switchover and failover
Database copy for testingAurora 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

  1. Console → RDS → Parameter groups → Create parameter group: family aurora-postgresql16, type DB Cluster Parameter Group, name hl-m06-l4-cluster. Edit it, set rds.force_ssl to 1, and save.
  2. 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 group hl-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>.
  3. 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.
  4. 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.

FailoverStopwatch/FailoverStopwatch.csproj
<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>
FailoverStopwatch/Program.cs
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.6s

Code explained line by line

  1. HL_WRITER and HL_READER come 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).
  2. Build(...): sets Timeout = 3 (connect) and CommandTimeout = 3, so a dead writer is detected in seconds, not in the default 15–30 seconds.
  3. 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.
  4. 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.
  5. Console.CancelKeyPress: Ctrl+C stops the loop cleanly and prints the summary.
  6. The INSERT ... RETURNING host(inet_server_addr()): one round trip that both proves the write landed and tells you where.
  7. if (outageStart is { } started): the first successful write after a failure closes the outage window and records its length.
  8. 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?".
  9. catch (... when ...): only database, timeout and socket failures count as an outage. Cancellation is handled separately.
  10. 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.
  11. 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):

RequirementRDS for PostgreSQL Multi-AZAurora PostgreSQL (writer + tier-0 reader) + Global Database
In-Region failoverMeasured 60–120 s including client DNSMeasured 15–30 s with short pool lifetimes; less with RDS Proxy
Read scaling for statementsRead replicas (async, separate storage)Reader endpoint, shared storage
Region lossCross-Region read replica, manual promotion, RPO = replica lagGlobal 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

SymptomLikely causeFix
App errors for minutes after failoverStale DNS or pooled connections to the old writerShort Connection Lifetime, retries, RDS Proxy
cannot execute INSERT in a read-only transactionConnected to the reader endpoint, or a just-demoted instanceUse the cluster endpoint for writes; reconnect after failover
First query after idle takes secondsServerless v2 paused at 0 ACURaise minimum capacity, or accept for dev/test
ServerlessDatabaseCapacity pinned at maximumMax ACU too low, or a bad queryRaise max; tune queries (see performance optimisation)
Can't add a Region to a global databaseSecrets Manager integration enabled, or unsupported version/classTurn off RDS-managed secret; check version support
Unexpected storage billI/O charges on Standard, or clones and snapshots retainedCompare 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 $REGION

If 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 with failover-db-cluster.
  • 🟡 Challenge: Change the stopwatch to use Npgsql's multi-host support. Put both instance endpoints in Host=, set Target Session Attributes=read-write for the writer data source and prefer-standby for 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

Knowledge check

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

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.

On this page