Aurora
πΈ 1. What is Amazon Aurora?¶
Amazon Aurora is a cloud-native relational database built by AWS, compatible with MySQL and PostgreSQL. Itβs designed to deliver:
-
5x the performance of MySQL
-
3x the performance of PostgreSQL
-
Enterprise-grade availability and durability
π§ Key Idea: Aurora is not a re-hosted DB like RDS for MySQL β itβs a purpose-built distributed system for speed, scalability, and fault tolerance.
πΈ 2. Aurora Engine Types¶
| Aurora Engine | Compatible With | Use Case |
|---|---|---|
| Aurora MySQL | MySQL 5.6/5.7/8.0 | Web apps, legacy migrations |
| Aurora PostgreSQL | PostgreSQL 10β15 | Complex queries, analytics |
| Aurora Serverless | Both | Auto-scaled, cost-effective dev/test |
πΈ 3. Aurora Architecture Overview¶
Aurora separates storage and compute, unlike traditional RDS.
+----------------------+
| Aurora Writer (RW) |
+----------------------+
|
+------------+-------------+
| |
+----------------+ +----------------+
| Aurora Reader | ... | Aurora Reader |
+----------------+ +----------------+
β¬ Async replication
+-------------------------+
| Aurora Distributed |
| Storage (up to 128 TB) |
+-------------------------+
π Key Points:
-
Compute nodes are isolated (Writer + up to 15 Readers)
-
Storage is auto-scaled and distributed across 3 AZs
-
Failures are handled automatically
πΈ 4. Aurora Performance Benefits¶
| Feature | Aurora vs RDS |
|---|---|
| Write Latency | 10x lower (via quorum write) |
| Read Scaling | Up to 15 read replicas |
| Failover Time | < 30 seconds |
| Auto-healing storage | β Yes |
| Parallel query (PostgreSQL) | β Supported |
πΈ 5. Aurora Replication¶
β Types of Replication:¶
| Type | Description |
|---|---|
| Aurora Replica | Native replica in same cluster |
| Cross-region Replica | DR/failover copy in another region |
| MySQL Read Replica | Legacy MySQL-style async replica |
πΈ 6. Aurora High Availability (HA)¶
β Built-in HA:¶
-
Storage is replicated across 6 copies in 3 AZs
-
Failover to Aurora Replica happens automatically
-
DNS switches to new Writer
-
No data loss (due to quorum writes)
π§ No need to configure Multi-AZ β it's built-in
πΈ 7. Aurora Serverless v2¶
π‘ What is it?¶
Aurora Serverless automatically scales the number of ACUs (Aurora Capacity Units) based on load.
| Feature | Aurora Serverless v2 |
|---|---|
| Auto-scaling | β Millisecond-level scaling |
| Cold Start | β No cold starts (v2 improvement) |
| Connections | Supports hundreds |
| Use Cases | Dev/test, variable workloads |
π You can set min/max capacity, schedule pause/resume, and integrate with Lambda or Fargate.
πΈ 8. Aurora Global Databases¶
Used for:
-
Cross-region disaster recovery
-
Low-latency global reads
| Feature | Description |
|---|---|
| Regions Supported | Up to 5 |
| Replication Delay | ~1 second |
| Write Region | One primary |
| Read Regions | Multiple |
Failover to a read region converts it to writer in ~1 minute.
πΈ 9. Aurora Security¶
| Feature | Description |
|---|---|
| IAM Auth | IAM roles for DB login |
| KMS Encryption | At-rest and in-transit (TLS) |
| VPC Isolation | Aurora is VPC-only |
| Secrets Manager | Store and rotate DB credentials |
| Audit Logging | Supported (CloudTrail + DB logs) |
πΈ 10. Backups and Snapshots¶
-
Continuous Backups to S3 (Point-in-time restore)
-
Manual Snapshots supported
-
Fast Cloning: Snapshots can be cloned instantly
-
Restore from Snapshot across regions
πΈ 11. Monitoring Aurora¶
| Tool | Metrics |
|---|---|
| CloudWatch | CPU, memory, storage, replica lag |
| Performance Insights | Query latency, bottlenecks |
| Enhanced Monitoring | OS-level visibility |
| Events/Logs | Slow query log, audit, error logs |
πΈ 12. Aurora Pricing¶
| Component | Pricing Model |
|---|---|
| Compute | On-demand per second (ACU or instance) |
| Storage | Per GB-month (auto-scales to 128 TB) |
| I/O | Per million requests (reads/writes) |
| Backup | First 100% of DB size is free |
| Serverless | Pay per ACU-second + I/O |
π‘ You only pay for what you use with Serverless.
πΈ 13. Aurora vs RDS¶
| Feature | Aurora | RDS |
|---|---|---|
| Performance | 3β5x faster | Baseline performance |
| Storage | Auto-scaled, 6 copies | Fixed GB |
| Read Replicas | Up to 15 | Up to 5 |
| Failover | ~30s automatic | Slower, may require config |
| OS-level access | β No | β (unless RDS Custom) |
| Serverless | β Aurora only | β Not supported |
| Global DB | β Yes | β Not supported |
πΈ 14. Terraform Sample: Aurora MySQL¶
resource "aws_rds_cluster" "aurora" {
cluster_identifier = "aurora-cluster"
engine = "aurora-mysql"
master_username = "admin"
master_password = "password123"
backup_retention_period = 7
skip_final_snapshot = true
}
resource "aws_rds_cluster_instance" "aurora_instance" {
count = 2
identifier = "aurora-instance-${count.index}"
cluster_identifier = aws_rds_cluster.aurora.id
instance_class = "db.r5.large"
engine = "aurora-mysql"
}
πΈ 15. Best Practices¶
β
Use Aurora Global DB for multi-region DR
β
Use Serverless for dev/test or variable workloads
β
Enable IAM + KMS + SSL
β
Set up CloudWatch alarms for failover/lag
β
Use Performance Insights to tune queries
β
Apply parameter groups for config tuning
β
Limit public access with proper SG rules
β
Store secrets in AWS Secrets Manager
πΈ 16. When to Use Aurora¶
| Scenario | Recommended |
|---|---|
| Need high availability and performance | β Aurora |
| Unpredictable workloads (auto-scaling) | β Serverless |
| Global app with multi-region reads | β Global DB |
| Full OS access required | β Use RDS Custom |
| Budget-conscious dev/test | β Aurora Serverless |