Lesson 3 of 4 · AWS Database Administration

Amazon Aurora

AWS's cloud-built MySQL- and PostgreSQL-compatible database: the cluster architecture, endpoints, Serverless v2, Global Database, and when to choose Aurora over RDS.

Beginner 8 sections 6 min read

What Aurora is

Amazon Aurora is AWS's own relational database, compatible with MySQL and PostgreSQL. Applications, drivers, and tools use it just like the open source engines, but underneath, AWS rebuilt the storage for the cloud, giving faster failover, more read copies, and storage that looks after itself.

Aurora comes in two editions: Aurora MySQL and Aurora PostgreSQL. Each version matches a MySQL or PostgreSQL version, such as Aurora PostgreSQL 16, so most applications move to it with few or no changes. It's managed through RDS, so the instance classes, parameter groups, maintenance windows, and backups from the Amazon RDS lesson all apply.

How an Aurora cluster works

The big difference from RDS is that Aurora separates compute from storage. An Aurora database is a DB cluster: one or more DB instances that all share one storage volume.

Cluster endpoint: reads, writes Reader endpoint: reads only Zone aZone bZone c Writer Reader Reader Shared cluster volume: six copies of the data, two in each zone
Every instance reads the same storage, so readers don't need their own copy of the data.
Cluster volume
The shared storage, which keeps six copies of every piece of data across three availability zones. A write succeeds once four copies have it, so the database keeps working even if a whole zone is lost. The volume grows automatically as data is added, so there's no storage to size, and it repairs damaged copies on its own.
Writer instance
The one instance in the cluster that accepts changes. Every insert, update, and delete goes through it.
Aurora Replicas (reader instances)
Up to 15 read-only instances. Because they read the same volume, they're usually less than a tenth of a second behind the writer, and adding one doesn't copy any data. They're also the failover targets: if the writer fails, Aurora promotes a reader, usually in about 30 seconds. There's no separate, idle standby to pay for.
Endpoints
Connection names that hide which instance is which. The cluster endpoint always points to the current writer, and the reader endpoint spreads connections across the readers. After a failover, applications reconnect to the same names.

Aurora Serverless v2

Instead of a fixed instance class, an instance can be Aurora Serverless v2, which grows and shrinks with the workload, in small steps, within limits you set. Capacity is measured in Aurora capacity units (ACUs), each about 2 GiB of memory with matching CPU and networking.

  • Set a minimum and maximum, such as 0.5 to 16 ACUs. You pay per second for the capacity actually used.
  • The minimum can be 0 ACUs, so an idle development database pauses automatically and costs nothing for compute. The first connection resumes it, after a short delay.
  • Serverless and provisioned instances can be mixed in one cluster, such as a provisioned writer with a serverless reader for occasional reporting.

It suits workloads that vary through the day, or that are hard to predict. For a busy database that runs flat out all day, a provisioned instance with a reservation is usually cheaper.

Global Database and other features

Aurora Global Database
Replicates a cluster to secondary clusters in other regions at the storage level, usually less than a second behind. Readers in each region serve local queries, and in a regional disaster a secondary region can take over in minutes. A planned switchover moves the primary without losing data, for example to rehearse disaster recovery.
Fast cloning
Creates a copy of a database in minutes, however large, because the clone shares the original's storage until either one changes data. It's ideal for giving testers a fresh copy of production data, after masking anything sensitive.
Backtrack
For Aurora MySQL only: rewinds the database in place to an earlier moment, up to 72 hours back, without restoring a backup. Useful after a mistake such as a DELETE without a WHERE clause.
Storage configurations
Aurora Standard charges for storage plus every I/O request. Aurora I/O-Optimized charges no I/O fees but costs more for instances and storage. It usually saves money once I/O is more than about a quarter of the database's bill.

Backups are continuous, with point-in-time restore for 1 to 35 days, and have no effect on performance. As on RDS, a restore creates a new cluster.

Aurora or RDS?

RDS for PostgreSQL or MySQLAurora PostgreSQL or MySQL
StorageDisk attached to each instance; you set its size and typeShared cluster volume with six copies, which grows automatically
High availabilityMulti-AZ standby; failover in one to two minutes, or under 35 seconds with a Multi-AZ DB clusterReaders double as failover targets; failover in about 30 seconds
Read copiesUp to 15 read replicas, each with its own storage, usually seconds behindUp to 15 readers sharing storage, usually milliseconds behind
ServerlessNoYes, Aurora Serverless v2
Cross-regionCross-region read replicasGlobal Database
CostUsually cheaper for small, steady databasesUsually better value for large, busy, or read-heavy databases
CompatibilityThe community engines, with every extension RDS supportsVery high, but some engine versions and extensions arrive later

Creating and connecting

Creating an Aurora database takes two steps: create the cluster, which holds the storage and settings, then add instances to it. Here's an Aurora PostgreSQL cluster with a serverless writer and a reader in another zone:

# 1. the cluster: engine, storage, network, and security
$ aws rds create-db-cluster --db-cluster-identifier kofi-aurora-pg \
    --engine aurora-postgresql --master-username postgres --manage-master-user-password \
    --db-subnet-group-name sales-db-subnets --vpc-security-group-ids sg-0abc1234 \
    --storage-encrypted --backup-retention-period 14 \
    --serverless-v2-scaling-configuration MinCapacity=0.5,MaxCapacity=16

# 2. the instances: a writer, then a reader in a different zone
$ aws rds create-db-instance --db-instance-identifier kofi-aurora-pg-1 \
    --db-cluster-identifier kofi-aurora-pg --engine aurora-postgresql \
    --db-instance-class db.serverless --availability-zone us-east-1a
$ aws rds create-db-instance --db-instance-identifier kofi-aurora-pg-2 \
    --db-cluster-identifier kofi-aurora-pg --engine aurora-postgresql \
    --db-instance-class db.serverless --availability-zone us-east-1b

Applications then use the two endpoints, with -ro- marking the reader endpoint:

# reads and writes
$ psql "host=kofi-aurora-pg.cluster-c1abcd2efgh3.us-east-1.rds.amazonaws.com dbname=postgres user=postgres sslmode=require"
# reports
$ psql "host=kofi-aurora-pg.cluster-ro-c1abcd2efgh3.us-east-1.rds.amazonaws.com dbname=postgres user=postgres sslmode=require"

In practice: taking reports off the writer

An orders application on RDS for PostgreSQL slows down every evening, when managers run reports. Kofi migrates it to Aurora PostgreSQL and adds two reader instances in other availability zones. The application keeps writing through the cluster endpoint, while the reporting tool connects to the reader endpoint, so reports no longer compete with orders.

The readers do double duty: in a failover test, Aurora promotes a reader in under 30 seconds, and the application reconnects to the same cluster endpoint. For the team's development clusters, Kofi uses Serverless v2 with a minimum of zero, so they cost almost nothing overnight.

Key takeaways

  • Aurora is AWS's MySQL- and PostgreSQL-compatible database, managed through RDS, with storage rebuilt for the cloud.
  • A cluster has one writer and up to 15 readers sharing a cluster volume that keeps six copies across three zones and grows automatically.
  • Readers are also failover targets, so failover takes about 30 seconds. Use the cluster endpoint for writes and the reader endpoint for reads.
  • Aurora Serverless v2 scales with the workload in ACUs, down to zero for idle databases.
  • Global Database covers regional disasters; fast cloning, backtrack, and the I/O-Optimized configuration help with testing, mistakes, and cost.
  • Choose RDS for small, steady databases, and Aurora for large, busy, or read-heavy ones.