This lesson combines 4 topics: Amazon ElastiCache, Amazon Redshift Introduction, Database Migration (DMS & SCT), Aurora Global Database (Deep Dive).
Learning Objectives
- Distinguish ElastiCache for Redis vs Memcached
- Understand cluster mode, replication, failover
- Master caching patterns: lazy loading, write-through
- Know when to use ElastiCache vs DAX
- Understand that Redshift is a data warehouse for analytics (OLAP)
- Distinguish RA3 nodes vs DC2 nodes
- Master Redshift Spectrum and Concurrency Scaling
- Know when to use Redshift vs Athena vs EMR
- Understand AWS DMS (Database Migration Service)
- Distinguish Homogeneous vs Heterogeneous migration
- Master SCT (Schema Conversion Tool)
- Know the migration strategies
- Understand Aurora Global Database architecture
- Master Write Forwarding and the failover process
- Compare with a regular cross-region read replica
Part 1: Amazon ElastiCache
1. ElastiCache Overview
ElastiCache = managed in-memory data store, supporting Redis and Memcached.
Use cases
- Database caching (reduce DB load)
- Session storage (user session, shopping cart)
- Leaderboards (gaming)
- Real-time analytics
- Message broker (Redis Pub/Sub)
- Rate limiting
Why use a cache
- Reduce latency (memory vs disk)
- Reduce load on the DB (cost optimization)
- Increase throughput
2. ElastiCache for Redis
Characteristics
- In-memory key-value + data structures: strings, lists, sets, hashes, sorted sets, streams
- Persistence: snapshots to S3, AOF (append-only file)
- Replication: read replicas (up to 5)
- Multi-AZ with automatic failover
- Encryption in-transit + at-rest
- Backup automated
- Pub/Sub messaging
2 deployment modes
Cluster mode disabled (default)
- 1 primary node + 0-5 read replicas
- Single shard
- Multi-AZ failover
Cluster mode enabled
- Sharding: data split across multiple shards (up to 500)
- Each shard: 1 primary + 0-5 replicas
- Total nodes = shards × (1 + replicas)
- Use case: data > single node memory, need horizontal scale
Architecture (Cluster Mode Disabled)
Architecture (Cluster Mode Enabled)
3. ElastiCache for Memcached
Characteristics
- Pure key-value cache (no data structures)
- Multi-threaded architecture (good for multi-core)
- Sharding: client-side (no built-in replication)
- No persistence (data lost on restart)
- No multi-AZ failover
- No backup
- Simpler, fewer features than Redis
Architecture
Client uses consistent hashing:
Key → hash → Node 1, 2, 3, ...
When to use Memcached
- Simple cache (no advanced features)
- Multi-threaded performance critical
- Cache can be rebuilt (data loss OK)
When to use Redis
- Data persistence required
- Need advanced data structures (sorted sets, hashes)
- Pub/Sub messaging
- Multi-AZ HA needed
- Cluster mode for sharding
4. Redis vs Memcached
| Feature | Redis | Memcached |
|---|---|---|
| Data structures | Strings, lists, sets, hashes, sorted sets, streams | String only |
| Persistence | Yes (snapshot + AOF) | No |
| Replication | Master-replica | No (client sharding only) |
| Multi-AZ | Yes (automatic failover) | No |
| Backup/Restore | Yes | No |
| Encryption | Yes (TLS, KMS) | Yes (TLS, KMS — 2018+) |
| Pub/Sub | Yes | No |
| Transactions | Yes (MULTI/EXEC) | No |
| Sharding | Cluster mode enabled | Client-side |
| Multi-threaded | No (Redis 6 added I/O threads) | Yes |
| Use case | Complex caching, sessions, leaderboards | Simple caching, ephemeral data |
2025 trend: Redis is used more and more. Memcached is declining.
5. Caching Patterns
5.1 Lazy Loading (Cache-Aside)
def get_user(user_id):
# 1. Check cache
user = cache.get(user_id)
if user is not None:
return user # Cache HIT
# 2. Cache miss → read from DB
user = db.get(user_id)
# 3. Write to cache
cache.set(user_id, user)
return user
Pros
- Only cache requested data (less memory)
- Cache failure ≠ app failure (read from DB)
Cons
- Cache miss penalty (3 trips: cache → DB → cache → app)
- Stale data possible (if DB updated, cache outdated)
- Cold start slow
5.2 Write-Through
def update_user(user_id, data):
# 1. Write to DB
db.update(user_id, data)
# 2. Write to cache (same time)
cache.set(user_id, data)
Pros
- Cache always fresh
- No cache miss penalty (data always there)
Cons
- Write latency higher (2 writes)
- Cache might contain rarely-read data (wasted memory)
5.3 TTL (Time To Live) + Lazy Loading
- Set TTL on cached items (e.g., 5 minutes)
- Auto-expire stale data
- Combine with lazy loading: TTL expiry → next read pulls fresh from DB
Common pattern: Lazy loading + TTL
- Best of both worlds
- Simple to implement
- Acceptable staleness (5-10 min)
6. Cache Replacement (Eviction)
Redis maxmemory policies
noeviction: error when fullallkeys-lru: evict least recently used (any key)volatile-lru: evict LRU among keys with TTL setallkeys-random,volatile-randomvolatile-ttl: evict keys with shortest TTL firstallkeys-lfu,volatile-lfu(Redis 4+): least frequently used
Memcached
- LRU only
7. Redis Cluster Mode
Sharding
- 16384 hash slots total
- Distributed across shards
- Key → CRC16(key) % 16384 → slot → shard
Resharding
- Add/remove shards → redistribute slots
- Online operation (no downtime)
Limitations
- Multi-key operations limited (keys must be in same slot)
- Use hash tags
{tag}to group keys:user:{u-001}:profile,user:{u-001}:orders
8. Security
Encryption in transit (TLS)
- Enable at cluster creation (cannot change later)
Encryption at rest
- KMS encryption
- Snapshots also encrypted
Authentication (Redis)
- Redis AUTH token
- Redis IAM (newer): IAM-based authentication
- Memcached: SASL authentication
Network
- Deploy in VPC
- Security Group control access
- Subnet group selection
9. Backup & Restore (Redis)
Snapshots
- Automated: daily, retention 0-35 days
- Manual: on-demand, indefinite retention
- Stored in S3 (managed)
- No performance impact (taken from replica)
Restore
- Restore from snapshot to new cluster
- Cross-region restore possible
10. DAX vs ElastiCache
| DAX | ElastiCache (Redis) | |
|---|---|---|
| For | DynamoDB only | Any data source (RDS, app, etc.) |
| API | DynamoDB API (transparent) | Custom (Redis client) |
| Caching pattern | Write-through automatically | Lazy loading or write-through (manual) |
| Cache key | Same as DynamoDB key | Custom |
| Setup | Simple (DynamoDB drop-in) | Custom code needed |
Use case
- DAX: Pure DynamoDB caching, no code change
- ElastiCache Redis: General cache, advanced data structures, sessions
11. ElastiCache Serverless (2023+)
Characteristics
- Pay per use (no capacity planning)
- Auto-scale instantly
- Supports both Redis and Memcached
- Min: ~512 MB cache size
- Supports ElastiCache's primary use cases without operational overhead
Use case
- Variable workload
- Dev/test
- New apps (don't know capacity)
12. Common Patterns
Pattern 1: Database cache (lazy loading + TTL)
App → Cache (Redis, lazy load) → RDS
TTL 5 min on cached items
Pattern 2: Session storage
User → ALB (no sticky session) → App tier (any instance)
App reads/writes session in Redis (shared)
Pattern 3: Leaderboard (Redis Sorted Set)
User score event → ZADD leaderboard score user_id
Top 10: ZREVRANGE leaderboard 0 9
Real-time updates with O(log N) performance
Pattern 4: Rate limiting
Redis INCR per user per minute
If count > limit → reject request
Part 2: Amazon Redshift Introduction
1. Redshift Overview
Amazon Redshift = fully managed petabyte-scale data warehouse for OLAP (analytics).
Characteristics
- Columnar storage: columns compress well, fast analytics queries
- MPP (Massively Parallel Processing): query split across nodes
- SQL-based (PostgreSQL-compatible)
- Scale: GB → petabyte
- Performance: 10x faster than traditional DB for analytics
Use cases
- Business Intelligence (BI) dashboards
- Reporting (sales, marketing analytics)
- Log analysis
- Data lakes (combined with S3 + Spectrum)
NOT for
- OLTP (transactional) workload — use RDS/Aurora
- Single-row lookups — use DynamoDB
- Real-time data ingestion at high frequency — buffer first
2. OLAP vs OLTP
| OLTP (RDS, Aurora, DynamoDB) | OLAP (Redshift) | |
|---|---|---|
| Workload | Transactions (insert, update) | Analytics (aggregation) |
| Query type | Few rows, indexed lookup | Many rows, full scan |
| Schema | Normalized | Denormalized (star/snowflake) |
| Data size | GB-TB | TB-PB |
| Storage | Row-based | Column-based |
| Performance metric | Latency (ms) | Throughput (GB/sec) |
3. Cluster Architecture
Components
Leader Node
- Coordinate queries
- Plan execution
- Aggregate results from compute nodes
Compute Nodes
- Actual query execution
- Data stored on local disk (DC2) or managed storage (RA3)
- Slices: parallel processing units per node
4. Node Types
RA3 (Recommended, 2019+)
- Managed storage: separate compute from storage
- Storage scales independently from compute
- Use S3-backed managed storage (auto-tier hot data on local SSD)
- Sizes: ra3.xlplus, ra3.4xlarge, ra3.16xlarge
- Pay for compute + managed storage
DC2 (Dense Compute)
- Local SSD storage attached
- Compute + storage tied together
- Smaller cluster (< 1 TB)
- Cheaper for small datasets
- Sizes: dc2.large, dc2.8xlarge
DS2 (Dense Storage) — Legacy
- HDD storage
- Deprecated, migrate to RA3
Recommendation
- RA3 for all new production workloads
- DC2 for small dev/test
5. Redshift Spectrum
Definition
Spectrum = query data directly in S3 from Redshift, without loading it into Redshift.
Characteristics
- Run SQL queries against S3 data (Parquet, ORC, CSV, JSON)
- Combine S3 data with Redshift tables (federated query)
- Pay per data scanned ($5/TB scanned)
- Use AWS Glue Data Catalog for schema
Use case
- Data lake architecture (S3 = storage, Redshift = compute)
- Query historical data in S3 (without loading)
- Cost-effective for infrequently accessed data
Example query
-- Query S3 data via Spectrum
SELECT *
FROM redshift_spectrum.s3_logs
WHERE date > '2024-01-01';
-- Join with Redshift table
SELECT u.name, COUNT(*)
FROM users u
JOIN redshift_spectrum.s3_events e ON u.id = e.user_id
GROUP BY u.name;
6. Concurrency Scaling
Definition
Add transient cluster capacity automatically when concurrent queries spike.
Characteristics
- Auto-scale within seconds
- Bills per second used (free credits available per cluster)
- Use case: many concurrent BI users
7. Redshift Data Loading
COPY command (primary method)
COPY my_table
FROM 's3://my-bucket/data/'
IAM_ROLE 'arn:aws:iam::111111111111:role/RedshiftS3Role'
DELIMITER ','
IGNOREHEADER 1;
Sources
- S3 (most common, parallel load)
- DynamoDB
- EMR
- Remote host (SSH)
- AWS DMS (from RDS, on-prem DB)
- Kinesis Data Firehose (streaming)
Best practice
- Split files into multiple parts (~1 GB each) → parallel load
- Use Parquet/ORC for compression
- Compress files (gzip, bzip2)
8. Redshift Backup
Automated snapshots
- Continuous backup to S3 (managed)
- Retention: 1-35 days
- Cross-region copy support
Manual snapshots
- User-initiated
- Retain indefinitely
Restore
- Restore to new cluster from snapshot
9. Redshift Security
Network
- VPC deployment
- Enhanced VPC Routing: force traffic through VPC (Spectrum, COPY)
- Security Group control access
Encryption
- At rest: KMS or HSM
- In transit: SSL
- Enable at cluster launch
Access control
- IAM for AWS-level (cluster management)
- Database users for SQL access
- IAM Database Authentication (token-based)
- Audit logs: STL_, SVL_ system tables → S3
10. Redshift Serverless
Definition
Redshift Serverless = on-demand Redshift, no cluster management.
Characteristics
- Pay per RPU-second (Redshift Processing Unit)
- Auto-pause when idle (save cost)
- Auto-scale based on workload
- Same SQL, same features as provisioned
Use case
- Sporadic analytics workload
- Dev/test environments
- New customer experimentation
Cost
- Free trial: $300 credits initially
- Pay-per-use after
11. Redshift vs Athena vs EMR
| Redshift | Athena | EMR | |
|---|---|---|---|
| Type | Data warehouse (cluster) | Serverless query | Managed Hadoop/Spark cluster |
| Performance | Fastest for complex SQL on TB | Good for ad-hoc | Variable, depends on cluster |
| Cost | Pay for cluster | Pay per query ($5/TB) | Pay for EC2 + EMR fee |
| Latency | Sub-sec to seconds | Seconds to minutes | Minutes |
| Setup | Provision cluster | None | Cluster management |
| Use case | BI dashboards, frequent queries | Ad-hoc, infrequent queries | Big data processing (ETL) |
Decision
- Frequent complex queries on TB-PB: Redshift
- Ad-hoc queries on S3: Athena
- Custom ETL with Spark/Hive: EMR
12. Modern Data Lake Architecture
Part 3: Database Migration (DMS & SCT)
1. AWS DMS Overview
AWS Database Migration Service (DMS) = a service that migrates databases to AWS, or between databases.
Characteristics
- Source → Replication Instance → Target
- Source keeps running during migration (minimum downtime)
- Supports full load + CDC (Change Data Capture) continuous replication
- Multi-AZ replication instance for HA
2 types of migration
Homogeneous (same engine)
- MySQL → RDS MySQL
- PostgreSQL → Aurora PostgreSQL
- Oracle → RDS Oracle
- No schema conversion needed (DMS handles)
Heterogeneous (different engine)
- Oracle → Aurora PostgreSQL
- SQL Server → MySQL
- Requires SCT to convert the schema first
- DMS migrates the data afterwards
Architecture
2. DMS Components
Replication Instance
- EC2 instance runs DMS engine
- Sizing: t3, c5, r5 (CPU + memory)
- Multi-AZ option (HA)
- In VPC, has connectivity to source + target
Endpoints
- Source endpoint: where data comes from
- Target endpoint: where data goes to
- Support 20+ databases (MySQL, PostgreSQL, Oracle, SQL Server, MongoDB, DynamoDB, S3, Aurora, Redshift...)
Migration Task
- Defines what to migrate (tables, columns, transformations)
- 3 types:
- Full load (initial migration)
- CDC only (continuous replication)
- Full load + CDC (most common — copy data, then keep in sync)
3. SCT (Schema Conversion Tool)
Definition
SCT = a desktop tool that converts the source database schema to the target schema (heterogeneous).
Characteristics
- Free tool (download and install locally)
- Convert: tables, indexes, views, stored procedures, functions
- Assessment report: identify issues, manual conversion needed
- Generate target schema, run on target before DMS
Workflow
1. Install SCT
2. Connect to source DB (Oracle)
3. Convert schema → SQL for target (PostgreSQL)
4. Review assessment report
5. Manually fix complex objects
6. Apply schema to target
7. Run DMS task migrate data
Supported conversions
- Oracle → PostgreSQL, MySQL, MariaDB
- SQL Server → PostgreSQL, MySQL, MariaDB
- MySQL → PostgreSQL
- Sybase → PostgreSQL, MySQL, MariaDB
- DB2 → PostgreSQL, MySQL, MariaDB
- Oracle DW → Redshift
- Teradata → Redshift
4. DMS vs SCT
| DMS | SCT | |
|---|---|---|
| Purpose | Data migration | Schema conversion |
| Type | Managed service | Desktop tool |
| Homogeneous | Yes (no SCT needed) | Not needed |
| Heterogeneous | Needs schema in target | Yes (convert schema) |
Order of operations (heterogeneous)
- SCT: Convert schema, apply to target
- DMS: Full load + CDC migration of data
- Cut over apps to target
5. Migration Strategies (Common)
Strategy 1: Lift-and-Shift (Rehosting)
- Move on-prem DB to RDS without changing engine
- DMS homogeneous (Oracle → RDS Oracle)
- Minimum changes, fastest
Strategy 2: Re-platforming
- Move + change platform (e.g., Oracle → Aurora PG)
- DMS heterogeneous + SCT
- Cost saving (Aurora PG cheaper than Oracle license)
Strategy 3: Refactoring
- Re-architect (e.g., monolithic SQL → DynamoDB + microservices)
- More work, more benefit
- Often involves rewriting app logic
6. DMS Best Practices
Pre-migration
- Test in non-prod first
- Assess schema complexity (SCT report)
- Optimize source DB (vacuum, analyze)
- Pre-create target schema (indexes after migration for speed)
During migration
- Disable triggers, indexes on target during full load (faster)
- Re-enable after full load complete
- Monitor CloudWatch metrics (CPU, memory, replication lag)
- Validate data with AWS DMS Data Validation
Cutover
- Stop writes on source briefly
- Verify CDC caught up (lag = 0)
- Switch apps to target endpoint
- Keep CDC running few hours for safety
7. DMS for Specific Targets
Target: S3
- Migrate database → S3 in CSV, Parquet, JSON
- Use case: data lake ingest from RDS
- Combine with Glue Crawler + Athena
Target: Redshift
- Migrate OLTP DB → Redshift data warehouse
- Use case: build analytics from operational data
Target: DynamoDB
- Migrate from relational to NoSQL
- Use case: re-architecting for scale
Target: Kinesis / OpenSearch
- Stream changes via CDC to data pipeline
- Real-time analytics
8. Other Migration Tools
AWS Application Migration Service (MGN)
- Lift-and-shift servers (OS + DB if on EC2)
- Continuous replication of source servers
- For migrating entire VMs/servers
AWS DataSync
- Migrate files (NFS, SMB, S3, EFS, FSx)
- Different from DMS (DMS = databases, DataSync = files)
AWS Snow Family
- Snowball Edge (no longer available to new customers; existing customers can still use it — the exam may still ask. New customers: DataSync or Data Transfer Terminal)
- Physical device for large data migration (TB-PB, use multiple devices in parallel for PB-scale)
- Use case: limited bandwidth, large dataset
- 2024 note: AWS discontinued Snowmobile and Snowcone (2024) — older exams/materials may still mention them; for PB-scale today, use multiple Snowball Edge devices or DataSync/Direct Connect
AWS Transfer Family
- Managed SFTP, FTPS, FTP for file transfer
- Use case: existing SFTP-based workflows
9. Migration Decision Matrix
10. Cost Considerations
DMS pricing
- Replication instance: per hour ($)
- Storage (logs, cache): $/GB
- Data transfer: standard rates (inbound to AWS free)
Cost optimization
- Right-size replication instance (start small, scale up if needed)
- Use Multi-AZ only for production cutover (not pre-test)
- Delete tasks/instances after migration complete
SCT
- Free (download tool)
11. Common Migration Scenarios
Scenario 1: Oracle on-prem → Aurora PostgreSQL
- Why: Reduce Oracle license cost
- How: SCT convert schema, DMS migrate data with CDC
- Effort: 1-3 months (depends on schema complexity)
Scenario 2: MySQL on-prem → RDS MySQL
- Why: Managed service, HA
- How: DMS homogeneous, optional Aurora upgrade later
- Effort: 1-4 weeks
Scenario 3: SQL Server on-prem → Aurora PostgreSQL
- Why: Cost optimization
- How: SCT + DMS, app changes for SQL dialect
- Effort: 3-6 months
Scenario 4: On-prem files (100 TB) → S3
- Why: Cloud storage migration
- How: Snowball Edge Storage Optimized (~80 TB usable/device per the exam; newer model 210 TB) → 1-2 devices
- Effort: 2-4 weeks (shipping included)
Part 4: Aurora Global Database (Deep Dive)
1. Aurora Global Database Overview
Aurora Global Database = an Aurora cluster with a primary region + up to 10 secondary regions, sub-second replication.
Characteristics
- 1 Primary region + up to 10 Secondary regions (old limit: 5 — the exam may still use it)
- Replicate via dedicated infrastructure (not standard MySQL/PostgreSQL replication)
- < 1 second replication lag typical
- RPO < 1 second
- RTO < 1 minute (failover)
- Read-only in secondary regions (or use Write Forwarding)
- Supports both Aurora MySQL and Aurora PostgreSQL
Limits
- Up to 10 secondary regions
- Up to 16 read replicas per secondary region
- Total: up to 160 read replicas across secondary regions (10 × 16)
2. Architecture
3. Use Cases
Disaster Recovery
- Primary fails → promote secondary → new primary
- RTO < 1 minute (vs hours for traditional restore)
- RPO < 1 second (minimal data loss)
Multi-Region Reads
- Global users get low-latency reads from nearest region
- e.g., US users → us-east-1, EU users → eu-west-1, Asia → ap-southeast-1
Cross-Region Migration
- Use Global Database for migration: replicate to new region, then cutover
4. Replication Mechanism
How it works
- Storage-level replication (not query replication)
- Dedicated infrastructure between regions
- Asynchronous BUT very fast (sub-second)
- No impact on primary performance
vs Standard Cross-Region Read Replica
| Aurora Global Database | Cross-region Read Replica | |
|---|---|---|
| Replication | Storage-level (dedicated infra) | Query-level (logical) |
| Lag | < 1 second | Seconds to minutes |
| Performance impact on primary | None | Some |
| Setup | Single click | Per replica |
| Failover time | < 1 minute (planned/unplanned) | Manual promote, longer |
5. Failover Process
Planned Failover
- Manual switch primary to secondary
- Use case: scheduled maintenance, region rebalancing
- ~30-60 seconds RTO
Unplanned Failover (DR)
- Primary region down
- Detach secondary from global DB
- Promote secondary to standalone cluster
- Update app connection string
- RTO: < 1 minute
Steps for unplanned failover
1. Detect primary region failure
2. Click "Failover global database" or use API
3. Select secondary region to promote
4. Aurora promotes secondary cluster to standalone
5. Update app to point to new primary endpoint
6. (Optionally) Re-add detached cluster as new secondary
6. Write Forwarding
Definition
Write Forwarding = secondary region can accept writes, forward to primary.
Characteristics
- App can write to secondary region's endpoint
- Aurora forwards write to primary, then replicates back
- Write latency = round-trip to primary + replication
- Read-after-write consistency options
Use case
- Multi-region apps where reads dominate but occasional writes
- Simpler app architecture (single connection logic)
Limitations
- Version requirements: Aurora MySQL 2.08.1+; Aurora PostgreSQL 14.9/15.4+ (PostgreSQL supported since 11/2023)
- Higher write latency than direct primary writes
- Not for write-heavy workloads (use primary directly)
7. Consistency Modes (Write Forwarding)
Eventual Consistency (default)
- Write returns immediately
- Read may not see the write yet
Session Consistency
- Read in same session sees previous writes
- Other sessions may lag
Global Consistency
- All sessions in region see write after replication
- Highest latency
8. Pricing
Components
- Primary cluster: standard Aurora pricing
- Secondary cluster: standard Aurora pricing (cheaper if smaller instance)
- Cross-region replication: $0.20/M I/O operations (or no extra cost for some)
- Cross-region data transfer
Cost optimization
- Smaller instances in secondary (read-only workload may be smaller)
- Aurora Serverless v2 in secondary (auto-scale)
9. Monitoring
CloudWatch metrics
- AuroraGlobalDBReplicationLag: time lag between regions
- AuroraGlobalDBProgressLag: log-based lag
- Per-secondary-region metrics
Alarms
- Alert when replication lag > threshold (e.g., 1 second)
- Trigger DR procedures if critical lag
10. Backup Strategy with Global DB
Backups in each region
- Primary region: automated backups + PITR
- Secondary region: also has automated backups (independent)
- → 2x backup storage but additional protection
Manual snapshots
- Can take from primary
- Can share/copy across accounts/regions
11. Common Patterns
Pattern 1: Multi-region SaaS
Primary: us-east-1 (writes)
Secondary: eu-west-1, ap-southeast-1, sa-east-1
Each region: ALB → App → local read replica
Writes: all go to primary (acceptable latency)
Pattern 2: DR with auto-failover
Primary: us-east-1
Secondary: us-west-2 (DR)
Route 53 health check on us-east-1 app
If unhealthy → auto-trigger Lambda → Promote Aurora secondary + DNS failover
Pattern 3: Global app with Write Forwarding
12. Aurora Global vs Alternatives
Aurora Global Database
- RTO < 1 min, RPO < 1 sec
- Up to 11 regions (1 primary + up to 10 secondaries)
- Aurora MySQL or PostgreSQL only
DynamoDB Global Tables
- Multi-master (active-active writes everywhere)
- Last-write-wins conflict resolution
- NoSQL only
RDS Cross-Region Read Replica
- Single replica per region (multiple possible)
- Slower replication
- Standard RDS engines (MySQL, PostgreSQL, MariaDB)
Manual replication (DMS)
- Highest flexibility, more complex
- For non-Aurora databases
Decision
- Aurora workload, need fast DR: Aurora Global Database
- NoSQL multi-region writes: DynamoDB Global Tables
- RDS non-Aurora: Cross-region read replica
- Custom logic: DMS
Review Questions
-
Redis supports persistence; what about Memcached?
Show answer
Redis: supports persistence via RDB (snapshot) and AOF (append-only file log). Data is not lost when a node restarts (it can be reloaded from disk). Supports replication, pub/sub, Sorted Sets, Streams. Memcached: no persistence — data is lost when a node fails or restarts. Pure in-memory, multi-threaded, no replication. Memcached is simpler and faster for pure caching use cases.
-
What are the drawbacks of the lazy loading pattern?
Show answer
Cache miss penalty: the first request for data (cache miss) must query the DB before writing into the cache — higher latency for the first requests. Stale data: if the DB is updated but the cache is not invalidated, reads from the cache return old data. Solution: TTL (Time-To-Live) to auto-expire, or combine with the Write-Through pattern to update the cache on write.
-
Is Multi-AZ failover supported in Redis or Memcached?
Show answer
Only Redis supports Multi-AZ with automatic failover. Redis has a primary + replicas — when the primary fails, a replica is promoted automatically (failover < 60 seconds). Memcached has no replication — if a node fails, the data in that node is lost and there is no failover. In a multi-node Memcached cluster, only the failed node's data is lost, not everything.
-
How does DAX differ from ElastiCache?
Show answer
DAX is a DynamoDB-specific cache — transparent, no code changes needed (use the DAX SDK instead of the DynamoDB SDK), caches DynamoDB table results directly, write-through, microsecond latency. ElastiCache is a general-purpose cache (Redis/Memcached) — requires code logic to check the cache before the DB, and is more flexible (cache anything: SQL query results, session data, computed values).
-
What is Redis Cluster Mode used for?
Show answer
Redis Cluster Mode enables horizontal scaling of the dataset by sharding data across multiple shards (each shard = 1 primary + N replicas). Without Cluster Mode: all data sits on 1 shard — limited by the memory of a single node. With Cluster Mode: the dataset can exceed one node's total memory, and write throughput is higher through parallel shards. Maximum 500 nodes per cluster.
-
Is Redshift used for OLAP or OLTP?
Show answer
OLAP (Online Analytical Processing) — data warehousing, analytics, reporting, BI. Columnar storage is optimized for aggregations and scans on specific columns in large datasets. Not suited for OLTP (many small transactions, row-level updates). OLTP uses RDS/Aurora. Redshift is designed for complex queries over billions of rows — data warehouse scale.
-
Where does Redshift Spectrum query data?
Show answer
Redshift Spectrum queries data directly from Amazon S3 — no need to load data into the Redshift cluster. It uses external tables (schemas in the AWS Glue Data Catalog). Thousands of nodes process S3 data in parallel. Suited for the "data lake" pattern: cold/historical data on S3, hot data in Redshift. Charged by bytes scanned ($5/TB).
-
How do RA3 and DC2 differ?
Show answer
DC2: compute-optimized with local SSD storage — storage is fixed per node type and cannot scale independently of compute. RA3: managed storage on Redshift Managed Storage (S3-backed) — compute and storage scale independently. RA3 fits when the dataset is larger than the total SSD of DC2 nodes. AWS recommends RA3 for new workloads because it is more flexible.
-
When should you use Athena instead of Redshift?
Show answer
Use Athena when: (1) Queries are ad-hoc and infrequent on S3 data, (2) You don't want to manage a cluster, (3) The dataset changes often (schema-on-read), (4) Low budget (pay-per-query). Use Redshift when: queries are complex and frequent, you need high performance (seconds vs minutes), data warehousing, BI dashboards that need consistent query time, or complex joins.
-
How is Redshift Serverless billed?
Show answer
RPU-hours (Redshift Processing Units per hour) — billed by the number of RPUs used while queries run. No charge when there are no queries (scale to zero). Minimum 8 RPUs, maximum 512 RPUs. Suited for sporadic, unpredictable workloads and development/test. A provisioned cluster is cheaper for steady, predictable workloads.
- When do you need SCT? When not?
Show answer
The AWS Schema Conversion Tool (SCT) is needed when migrating between different engines (heterogeneous): Oracle → Aurora PostgreSQL, SQL Server → MySQL. SCT converts schemas, stored procedures, and functions from the source dialect to the target dialect. SCT is not needed when migrating to the same engine (homogeneous): MySQL → RDS MySQL, Oracle → RDS Oracle — the schema is directly compatible, and only DMS is needed to migrate the data.
- What does DMS support CDC for?
Show answer
CDC (Change Data Capture) lets DMS capture real-time changes from the source database (inserts, updates, deletes) and apply them to the target — not just a one-time full load. Used for: (1) Zero-downtime migration — full load first, then CDC syncs ongoing changes, cut over when lag is near 0, (2) Ongoing replication — keep the target DB in sync with the source. CDC reads from transaction logs (binlog for MySQL, redo log for Oracle).
- What is the difference between DMS and DataSync?
Show answer
DMS (Database Migration Service): migrates database data — tables, rows, schema. Supports SQL databases, NoSQL, data warehouses. Used for database-to-database migration. DataSync: moves file/object data — from NFS, SMB, HDFS, S3, EFS, FSx. Optimized for large file transfers with validation and scheduling. DataSync does not understand database schemas — it transfers files as files.
- When migrating 200 TB of data with 100 Mbps bandwidth, what should you use?
Show answer
AWS Snowball Edge (or the Snowball Family). Quick math: 200 TB = 200 × 8 × 10⁶ Mb = 1.6 × 10⁹ Mb; ÷ 100 Mbps ≈ 1.6 × 10⁷ seconds ≈ 185 days over the internet — not practical. Snowball Edge physical devices store up to ~80 TB usable per device (use 3 devices for 200 TB; with the current 210 TB Storage Optimized model, 1 device), shipped to an AWS datacenter to import into S3 within a few days. Rule of thumb: if the transfer takes > 1 week over the internet → use Snowball. (Snowmobile used to be for > 10 PB but has been discontinued since 2024 — PB-scale now uses multiple Snowball Edge devices in parallel.)
- Where does the DMS replication instance run (managed or self-managed)?
Show answer
An AWS managed EC2 instance in your VPC — AWS manages the infrastructure, you only choose the instance class and configuration. DMS automatically patches, monitors, and restarts it if it fails. The replication instance must be able to connect to both the source and target endpoints. Place the replication instance in the same Region as the target (or between source and target) to reduce latency and data transfer cost.
- What is the maximum number of secondary regions for Aurora Global Database?
Show answer
Up to 10 secondary regions (the old limit was 5 — the exam may still use it). Each secondary region has a read-only Aurora cluster. In total: 1 primary + 10 secondary = 11 clusters. A secondary cluster can have up to 16 read replicas to scale read workload in that region. Useful for global applications that need low-latency reads from multiple continents.
- What are the typical RTO and RPO of Aurora Global Database?
Show answer
RPO < 1 second (replication lag is usually under 1 second — storage-level replication is very fast). RTO < 1 minute when promoting a secondary region to primary (managed failover). Unplanned failover when the primary region fails: about 1 minute to detect and promote. This lets Aurora Global Database meet RTO/RPO requirements for tier-1 applications that need cross-region DR.
- Which engines support Write Forwarding?
Show answer
Both Aurora MySQL (2.08.1+) and Aurora PostgreSQL (14.9/15.4+, supported since 11/2023). Write Forwarding lets a secondary region forward write requests to the primary region instead of returning a "read-only" error. Latency increases by the round-trip to the primary — not suited for write-heavy workloads over a long-distance network. Use it for applications that need session writes where most traffic is reads.
- At which layer does Aurora Global Database replicate (storage vs query)?
Show answer
Storage layer — Aurora Global Database replication happens at the storage engine level, not the SQL query level. All storage writes are written through distributed storage and forwarded to secondary regions via dedicated replication infrastructure. This is why replication lag is very low (< 1s) and does not affect the primary's write performance — replication does not go through the database query engine.
- How does it differ from a regular cross-region read replica?
Show answer
Cross-region read replica (binlog): replication via binlog at the database layer — lag can be 5-30 seconds, with overhead on the primary. Aurora Global Database (storage): storage-level replication with lag < 1s, no impact on primary performance, supports planned failover with a data integrity guarantee. Promoting a Global DB secondary is much faster and loses less data. It costs more than a read replica but gives a DR-grade solution.
Hands-on Exercises
Part 1: Amazon ElastiCache
- Create an ElastiCache Redis cluster (cluster mode disabled), 1 primary + 1 replica
- Implement the lazy loading pattern in an app: read cache, fall back to DB
- Set TTL 60 seconds, observe expiry
- Create Redis Cluster Mode Enabled with 3 shards
- Test failover: stop primary, observe replica promote
- Compare latency: DB direct vs DB + cache hit
Part 2: Amazon Redshift Introduction
- Create a Redshift Serverless workgroup (free trial)
- Load sample data from S3 with the COPY command
- Query with SELECT joins
- Set up Redshift Spectrum to query an S3 Parquet file
- Compare query performance: same query in Athena vs Redshift Spectrum
Part 3: Database Migration (DMS & SCT)
- Create a source MySQL on EC2, target RDS MySQL
- Set up a DMS replication instance + endpoints
- Create a Full Load + CDC task, observe migration
- Download SCT, connect to demo Oracle, convert to PostgreSQL schema
- Compare cost: DataSync vs Snowball for 50 TB
Part 4: Aurora Global Database (Deep Dive)
- Create an Aurora MySQL cluster
- Convert to Global Database, add a secondary in another region
- Test cross-region read latency
- Practice failover: promote secondary to new primary
- (Optional) Enable Write Forwarding, test from secondary
References
- ElastiCache User Guide
- Redis vs Memcached
- Caching Strategies
- ElastiCache Serverless
- Amazon Redshift Documentation
- Redshift Node Types
- Redshift Spectrum
- Redshift Serverless
- COPY command
- AWS DMS Documentation
- AWS SCT Documentation
- DMS Best Practices
- DataSync
- Application Migration Service
- Aurora Global Database
- Write Forwarding
- Failover