AWS Architecture & Services Deep Dive

AWS Database Services: RDS, DynamoDB & Aurora

4 min read

Database selection is often the most impactful architectural decision. Interviewers assess your ability to match database characteristics to workload requirements.

Database Selection Framework

Decision Matrix

FactorRelational (RDS/Aurora)NoSQL (DynamoDB)In-Memory (ElastiCache)
Data ModelStructured, normalizedKey-value, documentKey-value, sets, lists
Query PatternsComplex joins, aggregationsSingle-table, predictableSimple lookups, counters
ScalabilityVertical (read replicas)Horizontal (partitioning)Horizontal (sharding)
ConsistencyStrong (ACID)Eventually consistent (configurable)Eventually consistent
Use CaseTransactions, reportingHigh-scale web/mobileCaching, sessions

RDS: Managed Relational Databases

Engine Comparison

EngineStrengthsConsiderations
PostgreSQLExtensions, JSON support, complianceComplex replication setup
MySQLWide adoption, tooling ecosystemLimited JSON support
MariaDBMySQL-compatible, open sourceSmaller community
OracleEnterprise features, PL/SQLLicensing costs
SQL ServerWindows ecosystem, BI toolsLicensing costs

Interview Question: RDS High Availability

Q: "Design a highly available MySQL database for a financial application requiring RPO < 1 minute and RTO < 5 minutes."

A: Multi-AZ with enhanced monitoring:

Primary Configuration:
  - db.r6g.xlarge (Graviton, cost-efficient)
  - Multi-AZ deployment (synchronous replication)
  - gp3 storage (16,000 IOPS provisioned)
  - Automated backups (35-day retention)

High Availability:
  - Multi-AZ: Automatic failover < 60 seconds
  - Read Replicas: 2x in same region for read scaling
  - Cross-Region Replica: DR in us-west-2

Monitoring:
  - Enhanced Monitoring (1-second granularity)
  - Performance Insights enabled
  - CloudWatch alarms on replication lag

RPO/RTO Achievement:

  • Multi-AZ: RPO = 0 (synchronous), RTO < 2 minutes
  • Cross-Region: RPO < 1 minute (async), RTO < 5 minutes (manual promotion)

Aurora: Cloud-Native Relational

Aurora Architecture

Aurora separates compute and storage:

  • Compute: DB instances (writer + readers)
  • Storage: Distributed, auto-scaling (up to 128TB)
  • Replication: 6-way replication across 3 AZs

Aurora vs RDS Comparison

FeatureAuroraRDS
Storage ScalingAutomatic (10GB increments)Manual (requires downtime)
Replication Lag< 20ms typicallyMinutes possible
Failover Time< 30 seconds60-120 seconds
Read ReplicasUp to 15Up to 5
Cost~20% higherBaseline
Global DatabaseYes (< 1 second replication)Cross-region read replica only

Interview Question: Aurora Serverless v2

Q: "When would you choose Aurora Serverless v2 over provisioned Aurora?"

A: Aurora Serverless v2 suits:

  • Variable workloads: Dev/test with unpredictable usage
  • Bursty traffic: Scales instantly (0.5 ACU increments)
  • Cost optimization: Pay per ACU-hour
  • Multi-tenant: Different tenants with varying load

Choose Provisioned when:

  • Consistent, predictable workload
  • Maximum performance required (no cold start)
  • Cost certainty is priority
  • Already sized for peak capacity

Hybrid Approach: Provisioned writer + Serverless v2 readers for optimal cost/performance.

DynamoDB: Serverless NoSQL

Capacity Modes

ModeBest ForPricing
On-DemandUnknown/variable trafficPay per request
ProvisionedPredictable trafficReserved capacity, lower cost
Auto ScalingKnown patterns with peaksScales within limits

⚠ Prices change frequently. The values above are for illustration only and may be out of date. Always verify current pricing directly with the provider before making cost decisions: Anthropic · OpenAI · Google Gemini · Google Vertex AI · AWS Bedrock · Azure OpenAI · Mistral · Cohere · Together AI · DeepSeek · Groq · Fireworks AI · Perplexity · xAI · Cursor · GitHub Copilot · Windsurf.

DynamoDB Patterns

Single-Table Design:

PK                  SK                 Attributes
USER#123            PROFILE            {name, email}
USER#123            ORDER#456          {total, status}
USER#123            ORDER#789          {total, status}
ORDER#456           ORDER#456          {userId, items}

Access Patterns:

  • Get user profile: PK=USER#123, SK=PROFILE
  • Get user orders: PK=USER#123, SK begins_with ORDER#
  • Get order details: PK=ORDER#456, SK=ORDER#456

Interview Question: DynamoDB Hot Partition

Q: "Your DynamoDB table is experiencing throttling due to a hot partition. How do you resolve it?"

A: Hot partition mitigation strategies:

  1. Identify the hot key: Enable CloudWatch Contributor Insights
  2. Add randomness to partition key:
    # Instead of: PK = "STATUS#PENDING"
    # Use: PK = "STATUS#PENDING#" + random(1-10)
    
  3. Use write sharding with scatter-gather reads
  4. Implement caching layer: DAX for read-heavy, ElastiCache for write-buffering
  5. Consider on-demand mode: No throttling (but higher cost)

DynamoDB Global Tables

FeatureMulti-Region Benefit
Active-ActiveWrite to any region
Replication Lag< 1 second typically
Conflict ResolutionLast writer wins
Use CaseGlobal apps, DR

ElastiCache: In-Memory Caching

Redis vs Memcached

FeatureRedisMemcached
Data StructuresStrings, lists, sets, hashesStrings only
PersistenceYes (RDB, AOF)No
ReplicationYes (primary-replica)No
ClusteringYes (sharding)Yes
Use CaseComplex caching, sessionsSimple caching

Interview Question: Caching Strategy

Q: "Design a caching strategy for an e-commerce product catalog with 1M products."

A: Multi-tier caching approach:

Layer 1: CloudFront (Edge)
  - Cache static product images
  - TTL: 24 hours

Layer 2: ElastiCache Redis (Application)
  - Cache product details JSON
  - TTL: 1 hour (configurable per category)
  - Cluster mode: 3 shards, 2 replicas each
  - Memory: r6g.large per node (13GB)

Layer 3: DynamoDB DAX (Database)
  - Cache hot items
  - TTL: 5 minutes
  - Reduces DynamoDB read costs

Invalidation:
  - Event-driven: SNS on product update
  - Pattern: Cache-aside with lazy loading

Database Decision Tree

Need ACID transactions?
  └── Yes → Relational
       ├── Cloud-native, auto-scaling? → Aurora
       └── Traditional, lower cost? → RDS
  └── No → NoSQL
       ├── Key-value, predictable access? → DynamoDB
       ├── Document store, flexible schema? → DocumentDB
       └── Graph relationships? → Neptune

Need caching?
  └── Simple key-value? → ElastiCache Memcached
  └── Complex structures, persistence? → ElastiCache Redis
  └── DynamoDB-specific? → DAX

Interview Tip: Always discuss backup strategy, encryption at rest/in transit, and monitoring when presenting database architecture.

This concludes the AWS Architecture module. Test your knowledge with the module quiz. :::

Quick check: how does this lesson land for you?

Quiz

Module 2: AWS Architecture & Services Deep Dive

Take Quiz
FREE WEEKLY NEWSLETTER

Stay on the Nerd Track

One email per week — courses, deep dives, tools, and AI experiments.

No spam. Unsubscribe anytime.