[AWS] Aurora

Aurora is an AWS relational database engine that is compatible with MySQL and PostgreSQL.


Amazon Aurora

Amazon Aurora combines the speed and availability of high-end commercial databases with the simplicity and cost-effectiveness of open source databases.

  • Amazon Aurora is up to five times faster than standard MySQL databases and three times faster than standard PostgreSQL databases.
  • It provides the security, availability, and reliability of commercial databases at 1/10th the cost.

Features

Amazon Aurora is a distributed, fault-tolerant, self-healing storage system that auto-scales up to 128TB per database instance. It delivers high performance and availability with up to 15 low-latency read replicas, point-in-time recovery, continuous backup to Amazon S3, and replication across three Availability Zones (AZs).

  • Aurora uses a base configuration of a cluster, which contains a single primary instance and zero or more replicas.
  • All instances (primary and replicas) use the same shared storage – the cluster volume.
  • Reads and writes use the cluster endpoint.

High Availability and complete Fault Tolerance

  • Aurora has 2 copies of data in each AZ with a minimum of 3 AZs (6 copies).
    • Aurora requires 4 copies without affecting write availability.
      • It is designed to handle the loss of up to two copies of data for writing.
    • Aurora requires 3 copies without affecting read availability.
      • Can handle the loss of up to three copies of data for reading.
  • Aurora storage is self-healing. Data blocks are scanned and repaired continuously.
  • Aurora’s failover hierarchy ranges from Tier 0 to Tier 15. Tier 0 has the highest priority in Aurora’s failover hierarchy.

A cluster volume is SSD, which can scale up to 64 TiB and auto-healing. (Start with 10 GiB, 10 GiB increment)

  • Cluster volumes scale automatically and are charged only for consumed data – backed up to S3.

Cluster and Endpoints

Aurora involves a cluster of DB instances instead of a single instance. When you connect o an Aurora cluster, you can use an endpoint, which abstracts the connection.

  • Endpoint = host address + port
  • You can have multiple endpoints.
    • Each endpoint maps a connection to an appropriate group of instances based on the use cases such as write or read.

Types of Aurora endpoints

  • Cluster endpoint
    • connects to the primary DB instance of the cluster
    • only endpoint that can perform write operations
  • Reader endpoint
    • Queries can point to the reader endpoint, which connects to one of read replicas with load balancing.
  • Custom endpoint
    • represents a subset of DB instances in the Aurora cluster
    • Types:
      • Reader
      • Writer
      • ANY
    • Use case
      • Set up some replica instances with more powerful VMs and use them to run analytic queris
  • Instance endpoints
    • connects to a specific DB instance in a cluster

Backups and Snapshots

  • Automated backups are enabled by default.
  • You can take snapshots without affecting the performance.
  • You can share Aurora snapshots with other AWS accounts.

Aurora Backtrack

  • Backtrack allows you to roll back a database for up to 72 hours.
  • It does not create a new database or a new cluster. Instead, Aurora rolls back the same database to a previous state.

Aurora Read Replicas

Read Replica Features

  • Aurora supports up to 15 replicas.
  • Cross-region replicas are supported.
  • The automated backups are turned on by default.
  • You can share Aurora snapshots with other AWS accounts.

RDS Proxy for Aurora

  • You can create a read-only endpoint that connects to Aurora Read Replicas only.

Promoting Read Replica (cross-region) to the Primary

  1. Save the Aurora endpoint (Connection info) in the Systems Manager Parameter Store
    • Update the application to retrieve the endpoint from the Systems Manager Parameter Store
  2. Create an EventBridge event that captures database failures
  3. Runs the Lambda function to promote the read replica to the primary
  4. Update the endpoint in the Systems Manager Parameter Store

Aurora Parallel Query

Parallel Query is used to running large queries in all storage nodes in parallel inside the cluster.


Aurora Serverless

Aurora Serverless is an on-demand, auto-scaling edition of Amazon Aurora.

  • It is a cost-effective option for infrequent or unpredictable workloads with easier setup.
    • Used for Development or QA environments
  • The database endpoint (secure HTTPS) connects to a proxy fleet that routes the workload to a fleet of resources that are automatically scaled.
    • Client applications do not need to change how to use the proxy fleet. Aurora Serverless manages the connections automatically.
  • You specify the minimum and maximum load levels with Aurora Capacity Units, and Aurora Serverless scales based on the incoming load automatically.
  • Aurora Serverless charges based on the resources used per second.
  • You can even scale down to zero. It can be paused after the specified duration of inactivity.
  • You can use CLI or Data API to connect to Aurora Serverless. Using the Data API, you can access Aurora Serverless from the Query Editor or Lambda functions.

Aurora Global Database

Amazon Aurora Global Database is designed for globally distributed applications, allowing a single Amazon Aurora database to span multiple AWS regions.

  • Structure
    • 1 Primary cluster (read & write)
    • Secondary read-only clusters in other regions (up to 5)
  • The typical cross-region replication latency is below 1 second. (RPO)
  • Used for Cross-Region Disaster Recovery
    • In the failover scenario, you can promote one of the secondary regions to take read/write responsibilities. An Aurora cluster can recover in less than 1 minute (RTO), even in the event of a complete regional outage.
  • It provides your application with an effective Recovery Point Objective (RPO) of 1 second and a Recovery Time Objective (RTO) of less than 1 minute.

Converting RDS Database to Aurora

  • Option 1
    1. Create a snapshot from the RDS
    2. Restore the snapshot to Aurora
  • Option 2
    1. From the RDS instance, create an Aurora Read Replica
    2. Promote the Aurora Read Replica to the Primary Aurora instance

Leave a Comment