Database replication (for example, read replicas)

Task Statement 3.3: Determine high-performing database solutions.

📘AWS Certified Solutions Architect – (SAA-C03)


1. What is Database Replication?

Database replication is the process of copying data from one database (primary) to one or more other databases (replicas).

  • The primary database handles writes (INSERT, UPDATE, DELETE)
  • The replica databases mainly handle reads (SELECT)

This helps improve:

  • Performance
  • Availability
  • Scalability

2. Why Replication is Important

Replication is used in AWS to solve key performance and reliability challenges:

1. Improve Read Performance

  • Applications often have more read requests than write requests
  • Replicas handle read traffic, reducing load on the primary database

2. Increase Availability

  • If the primary database fails, replicas can be promoted (in some cases)
  • Helps reduce downtime

3. Disaster Recovery

  • Replicas can exist in different Availability Zones or Regions
  • Protects against infrastructure failure

4. Offload Workloads

  • Reporting, analytics, and backups can run on replicas instead of the primary

3. Types of Replication in AWS

A. Read Replicas

This is the most important concept for the exam.

Key Features:

  • Copies data from the primary database
  • Used for read-only workloads
  • Supports asynchronous replication

Supported Services:

  • Amazon RDS (MySQL, PostgreSQL, MariaDB, Oracle, SQL Server)
  • Amazon Aurora

How it Works:

  1. Data is written to the primary database
  2. Changes are copied to replicas
  3. Applications read from replicas

Important Characteristics:

  • Eventually consistent (not immediate)
  • Can have multiple replicas
  • Can be in:
    • Same Availability Zone
    • Different Availability Zones
    • Different Regions (cross-region replication)

B. Multi-AZ Deployment (Different from Read Replicas)

This is often confused with read replicas.

Key Features:

  • Synchronous replication
  • Used for high availability, not scaling reads
  • Standby instance is not used for reading

Behavior:

  • Primary → synchronous copy → standby
  • Automatic failover if primary fails

Key Difference:

FeatureRead ReplicaMulti-AZ
PurposeImprove read performanceHigh availability
Read accessYesNo
Replication typeAsynchronousSynchronous
FailoverManualAutomatic

C. Aurora Replication

Amazon Aurora has advanced replication features:

Key Features:

  • Automatically creates up to 15 read replicas
  • Replication is faster than standard RDS
  • Uses shared storage across replicas

Benefits:

  • Low latency (milliseconds)
  • Automatic failover
  • High scalability

Aurora Replica vs RDS Replica:

  • Aurora replicas share storage → faster
  • RDS replicas use separate storage → slower

4. Types of Replication Modes

1. Asynchronous Replication

  • Data is copied after it is written to the primary
  • Small delay (replication lag)
  • Used by:
    • Read replicas

Pros:

  • Faster performance
  • Scales easily

Cons:

  • Data may not be up-to-date

2. Synchronous Replication

  • Data is written to both primary and replica at the same time
  • No data loss

Pros:

  • Strong consistency

Cons:

  • Higher latency

Used in:

  • Multi-AZ deployments

5. Replication Lag

Replication lag = delay between primary and replica data

Causes:

  • High write traffic
  • Network latency
  • Large transactions

Impact:

  • Users may read outdated data

Monitoring:

  • Use Amazon CloudWatch metrics

6. Use Cases (IT-focused)

1. Web Applications

  • Primary handles writes (user data updates)
  • Replicas serve read requests (fetching data)

2. Reporting Systems

  • Reports run on replicas to avoid affecting production performance

3. Data Warehousing Pipelines

  • Data is replicated to another database for analytics processing

4. Global Applications

  • Cross-region replicas reduce latency for users in different locations

7. Cross-Region Replication

  • Read replicas can be created in another AWS Region
  • Useful for:
    • Disaster recovery
    • Global applications

Benefits:

  • Reduced latency for global users
  • Regional isolation

8. Promotion of Read Replica

  • A read replica can be promoted to standalone database

When used:

  • Primary database failure
  • Migration scenarios

Important:

  • After promotion:
    • It becomes independent
    • No longer receives updates from the original primary

9. Best Practices for the Exam

1. Use Read Replicas When:

  • Application is read-heavy
  • Need to scale reads
  • Reporting queries are slowing down the database

2. Use Multi-AZ When:

  • High availability is required
  • Automatic failover is needed

3. Use Aurora When:

  • Need high performance and fast replication
  • Need many replicas

4. Watch for Replication Lag:

  • Avoid using replicas for critical real-time data reads

5. Combine Solutions:

  • Multi-AZ + Read Replicas = high availability + scalability

10. Common Exam Questions Patterns

Be prepared for questions like:

Scenario 1:

  • Application has heavy read traffic
  • Solution → Add read replicas

Scenario 2:

  • Need automatic failover
  • Solution → Multi-AZ deployment

Scenario 3:

  • Global users need low latency reads
  • Solution → Cross-region read replicas

Scenario 4:

  • Need fast replication and many replicas
  • Solution → Amazon Aurora

11. Quick Summary

  • Read Replicas → Improve read performance (asynchronous)
  • Multi-AZ → High availability (synchronous)
  • Aurora → Advanced, fast, scalable replication
  • Replication Lag → Delay in data syncing
  • Cross-region → Disaster recovery + global access
Buy Me a Coffee