Lesson 3 of 5 Amazon RDS and Amazon Aurora

Scaling Reads with Replicas and Aurora Serverless v2

This lesson explains how relational databases scale reads out with replicas, and how Aurora adds automatic replica scaling and serverless capacity.

Learning outcomes

After completing this lesson, you will be able to:

  • Use RDS read replicas.
  • Scale Aurora Replicas with Aurora Auto Scaling.
  • Use Aurora Serverless v2 capacity.

RDS read replicas

An RDS read replica is a separate DB instance kept up to date by asynchronous replication from the source. Up to 15 replicas are supported for MySQL, MariaDB and PostgreSQL. Applications must send read queries to the replica's own endpoint, so the application must be able to separate reads and writes. Replicas can be in another AZ or another Region (cross-Region replicas for DR and local reads), can have a different instance class, and can be promoted to a standalone instance, which breaks replication. Automated backups must be enabled on the source. ReplicaLag shows how far behind a replica is; heavy writes, an undersized replica or long-running queries on the replica increase it.

Scenario questions

Scaling reads

Exam skills 2.1.3

Choose how to scale database reads.

Log in to try this activity Interactive activities are free with an account.

Aurora replicas and Aurora Auto Scaling

An Aurora cluster has one writer and up to 15 Aurora Replicas that share the cluster's storage volume, so replica lag is typically under 100 milliseconds. The cluster endpoint always points to the writer, the reader endpoint load-balances connections across replicas, and custom endpoints group specific instances, for example larger replicas for reporting. Aurora Auto Scaling, an Application Auto Scaling policy, adds or removes replicas to keep average reader CPU or connections at a target. Replicas also act as failover targets, chosen by promotion tier (0 is highest priority).

Aurora Serverless v2

Aurora Serverless v2 instances scale capacity in fine-grained increments of 0.5 Aurora capacity units (ACUs), where 1 ACU is about 2 GiB of memory with matching CPU and networking, between a minimum and maximum you set (a minimum of 0 ACUs lets an idle instance pause automatically). Scaling happens in place in seconds without dropping connections. Serverless v2 instances can be mixed with provisioned instances in the same cluster, for example a provisioned writer and serverless readers, and support Multi-AZ, replicas and Global Database. The ServerlessDatabaseCapacity and ACUUtilization metrics show current capacity; a minimum set too low causes slow performance after idle periods because the buffer cache has shrunk.

The following table summarises the database scaling options.

NeedOption
More capacity for writesLarger instance class (scale up)
Offload reads on RDSRead replicas with application read/write split
Offload reads on Aurora with automatic adjustmentAurora Replicas with Aurora Auto Scaling and the reader endpoint
Variable or unpredictable load on AuroraAurora Serverless v2
Storage filling upStorage autoscaling (RDS); Aurora storage grows automatically
Repeated identical queriesElastiCache in front of the database

The following diagram shows capacity following load between the minimum and maximum.

How Aurora Serverless v2 capacity follows load. Capacity scales in place in steps of 0.5 ACUs, about 1 GiB each, between the minimum and maximum set for the instance, without dropping connections. A minimum of 0 ACUs lets an idle instance pause, and a minimum set too low can leave the instance slow to warm its buffer cache.
The curve is illustrative. Raising the minimum keeps more memory warm at the cost of paying for it when idle.
Worked example

Reporting queries slow the application

An Aurora PostgreSQL cluster serves an online store, and analysts run heavy reports during the day that slow customer queries on the shared reader. The team adds two larger Aurora Replicas, places them in a custom endpoint named reporting, and points the reporting tool at it. The default reader endpoint, used by the store, is configured with Aurora Auto Scaling between two and six replicas at 60% CPU. The reporting replicas are given promotion tier 15 so that a failover always prefers a store replica.

Check yourself

In which unit does Aurora Serverless v2 scale?

Show answer

Aurora capacity units (ACUs), in increments of 0.5; one ACU is about 2 GiB of memory with matching CPU and networking.

Exam Tips

Remember for the exam

  • RDS read replicas are asynchronous and need the application to send reads to their endpoints.
  • Aurora Replicas share storage; use the reader endpoint and Aurora Auto Scaling.
  • Custom endpoints isolate workloads such as reporting.
  • Aurora Serverless v2 scales in 0.5 ACU steps between a minimum and maximum.
  • Promotion tiers decide which Aurora Replica becomes writer on failover.