Skip to main content
Back to Curriculum/AWS Architecture Guide
AWS MANAGED ECOSYSTEMMulti-Region • Serverless • HA

AWS Reference Architecture & System Design Mastery Guide

The ultimate reference manual mapping distributed primitives to AWS cloud native offerings. Includes cross-region replication strategies, failover runbooks, messaging decision matrices, interactive service directory, and cost guardrails.

Interactive AWS Service Catalog & Architecture Explorer

Direct deep dives, latency SLAs, replication topologies, and cross-curriculum blueprint mapping for 18 AWS managed services.

Amazon ElastiCache

In-Memory Caching
Target Anchor: #elasticache
Sub-millisecond (< 1ms p99)

Managed OSS & Memcached in-memory caching engine engineered for ultra-low-latency session stores, distributed locks, real-time gaming leaderboards, and database read offloading.

Key Architectural Patterns & Primitives

(Lazy Loading): Reads check cache first; on miss, load from Aurora/DynamoDB and set with + .
Sorted Sets (ZSET): Real-time leaderboard ranking with O(log N) insertion and range retrieval.
Pub/Sub: Ephemeral multicast message broadcast for WebSocket connection node clusters.
Distributed Locks (Redlock / SETNX): Atomic lease acquisition with and for mutual exclusion.
High Availability & Replication

Mode Enabled (up to 500 shards, 310 TB RAM) with Multi-AZ automatic failover (< 30s) and Global Datastore cross-region replication (< 1s lag).

Production Pitfalls & Memory Tuning
  • Reserve 25% memory (reserved-memory-percent = 25) for snapshotting/BGSAVE to prevent Out-Of-Memory crashes.
  • Configure volatile-lru or allkeys-lru eviction policies based on whether all keys have explicit TTLs.
  • Use client-side connection pooling to prevent TCP handshake exhaustion during traffic spikes.
Curriculum Blueprints Using Amazon ElastiCache (36)
01.Consistent Hashing02.Distributed Rate Limiting03.Bloom Filters & Counting Filters04.Distributed Caching Patterns & Eviction11.Geospatial Indexing (Geohash, Quadtree, S2 & H3)12.Change Data Capture (CDC) & Outbox Pattern18.WebSocket, Server-Sent Events (SSE) & Long Polling20.OAuth 2.0, OIDC & Distributed Token Authentication22.Circuit Breaker, Bulkhead & Fault Tolerance Patterns23.Event Sourcing & CQRS Architecture25.Bot Defense, Sybil Resistance & Registration Abuse Mitigation27.Disposable Email & Domain Blocklists28.Cloudflare Turnstile & Managed Challenges29.Google reCAPTCHA v2 & Enterprise Risk Analysis30.Hashcash & Client-Side Proof of Work01-04:Design a Distributed Rate Limiter01-05:Design a Distributed URL Shortener (TinyURL)02-01:Design a Scalable News Feed System02-02:Design a Real-Time Chat & Instant Messaging System02-03:Design a Real-Time Gaming Leaderboard02-04:Design a Scalable Distributed Notification System03-02:Design a Search Autocomplete System03-03:Design a Web Crawler at Scale04-02:Design a Digital Wallet System04-04:Design a Hotel Reservation System05-01:Design a Proximity Service (Yelp / Places Nearby)05-02:Design Google Maps & Distributed Routing Engine05-03:Design Nearby Friends Real-Time Location Service06-01:Design YouTube Video Streaming Platform06-02:Design Google Drive File Sync & Storage06-03:Design Real-Time Ad Click Event Aggregation07-01:Design Mobile News Feed with Offline-First Architecture07-02:Design Mobile Chat Client Architecture07-03:Design Mobile Stock Trading & Market Ticker App07-04:Design Mobile Paging & Infinite Scrolling Library Architecture08-06:Design a Resilient Bot Defense & Sybil-Resistant Registration Architecture — Production Case Study

Amazon DynamoDB

Database
Target Anchor: #dynamodb
Single-digit millisecond (< 5ms p99); sub-ms with DAX

Fully managed distributed NoSQL key-value and document database offering consistent single-digit millisecond latency at any scale, , and multi-region active-active replication.

Key Architectural Patterns & Primitives

: Co-locating multiple entity types in a single table with generic PK/SK and for O(1) single-partition queries.
Streams: () event log for downstream search index sync, cache invalidation, and async fanout.
Idempotency Gate & Conditional Writes: attribute_not_exists(idempotency_key) ensuring exact-once transactional processing.
Global Tables: Multi-Region Active-Active replication with Last-Writer-Wins (LWW) conflict resolution.
High Availability & Replication

Automatic 3-AZ synchronous Paxos per partition; asynchronous Global Tables replication across AWS regions (< 1s lag).

Production Pitfalls & Memory Tuning
  • Avoid monotonically increasing (e.g. timestamps) that create bottlenecks (1,000 / 3,000 limit per partition). Use (pk#0..9).
  • Avoid high-selectivity FilterExpression queries; they read entire partitions before filtering. Structure PK/SK or use instead.
  • Leverage for automated background record expiration with zero consumption.
Curriculum Blueprints Using Amazon DynamoDB (49)
01.Consistent Hashing03.Bloom Filters & Counting Filters04.Distributed Caching Patterns & Eviction05.Message Queues vs. Event Streams06.Distributed Locks & Leases07.Write-Ahead Log (WAL) & LSM-Trees08.Database Sharding & Partition Keys09.Distributed Consensus (Raft & Paxos)10.Two-Phase Commit (2PC) & Saga Orchestration11.Geospatial Indexing (Geohash, Quadtree, S2 & H3)12.Change Data Capture (CDC) & Outbox Pattern15.Distributed Unique ID Generators16.Gossip Protocol & Failure Detection18.WebSocket, Server-Sent Events (SSE) & Long Polling21.Database Isolation Levels, ACID & Concurrency Anomalies23.Event Sourcing & CQRS Architecture24.Cloud Disaster Recovery & Multi-Region Active-Active25.Bot Defense, Sybil Resistance & Registration Abuse Mitigation26.Honeypot Fields & Canary Traps27.Disposable Email & Domain Blocklists01-01:Design a Distributed Key-Value Store01-02:Design a Distributed Unique ID Generator01-03:Design a Distributed Message Queue01-04:Design a Distributed Rate Limiter01-05:Design a Distributed URL Shortener (TinyURL)02-01:Design a Scalable News Feed System02-02:Design a Real-Time Chat & Instant Messaging System02-03:Design a Real-Time Gaming Leaderboard02-04:Design a Scalable Distributed Notification System03-01:Design S3-Like Distributed Object Storage03-02:Design a Search Autocomplete System03-03:Design a Web Crawler at Scale03-04:Design a Distributed Metrics Monitoring & Alerting System03-05:Design a Distributed Job Scheduler & Task Execution Queue04-01:Design a Payment Processing System04-02:Design a Digital Wallet System04-04:Design a Hotel Reservation System05-01:Design a Proximity Service (Yelp / Places Nearby)05-03:Design Nearby Friends Real-Time Location Service05-04:Design a Real-Time Ride-Sharing Dispatch Service (Uber/Lyft)06-01:Design YouTube Video Streaming Platform06-02:Design Google Drive File Sync & Storage06-03:Design Real-Time Ad Click Event Aggregation06-04:Design a Distributed Email Service07-01:Design Mobile News Feed with Offline-First Architecture07-02:Design Mobile Chat Client Architecture07-03:Design Mobile Stock Trading & Market Ticker App08-01:Design Netflix's Global Video Streaming & Zuul API Architecture08-06:Design a Resilient Bot Defense & Sybil-Resistant Registration Architecture — Production Case Study

Amazon Aurora

Database
Target Anchor: #aurora
Low single-digit millisecond (< 3ms p99)

High-performance distributed relational database engine (MySQL/PostgreSQL compatible) with separated compute and log-structured storage tiers, Serverless v2, and Global Databases.

Key Architectural Patterns & Primitives

Log-Structured Storage Engine: Write path emits only REDO log records to a distributed 6-way replicated storage cluster across 3 AZs.
Global Database: Storage-level cross-region replication with replication lag < 1s and zero compute impact on primary writer.
Serverless v2: Instant sub-second scaling in fine-grained Capacity Units (ACUs) for volatile transaction spikes.
Read Replica Auto-Scaling: Up to 15 auto-scaled reader replicas sharing the same underlying distributed cluster volume.
High Availability & Replication

-based 4/6 and 3/6 across 3 AZs; asynchronous storage replication across regions.

Production Pitfalls & Memory Tuning
  • Always deploy Amazon RDS Proxy in front of when using serverless compute (AWS Lambda) to multiplex and pool database connections.
  • Route heavy analytical SQL queries to dedicated Reader Endpoints to protect Writer buffer pool memory.
  • Set failover priority tiers (tier-0, tier-1) on read replicas for deterministic Multi-AZ failover target promotion.

Amazon S3

Storage
Target Anchor: #s3
Single-digit ms (S3 Express One Zone) / 50-100ms first-byte (Standard)

Exabyte-scale distributed object storage providing 11 9s durability, granular prefix partitioning, multipart chunked uploads, presigned URLs for direct client transfer, and automated lifecycle tiering.

Key Architectural Patterns & Primitives

Multipart Parallel Uploads: Chunking large files (> 100MB) into 5MB–5GB parts uploaded concurrently with MD5/SHA256 checksums.
Presigned URLs: Secure temporary authorization for direct client-to- uploads/downloads without routing bytes through API compute instances.
Intelligent-Tiering: Automatic data movement between Frequent, Infrequent, and Archive Instant Access tiers saving up to 68% cost.
Cross-Region Replication (CRR): Asynchronous byte replication with RTC (Replication Time Control) 15-minute .
High Availability & Replication

Synchronous erasure coding across minimum 3 Availability Zones; asynchronous cross-region replication.

Production Pitfalls & Memory Tuning
  • Structure high-throughput object keys with hash prefixes (s3://bucket/data/<hash>/file) to scale across multiple partition shards.
  • Enable Bucket Versioning and Object Lock with WORM (Write Once, Read Many) compliance for financial ledgers and compliance logs.
  • Configure automated lifecycle expiration rules on multipart upload aborts (AbortIncompleteMultipartUpload) to eliminate orphaned storage costs.
Curriculum Blueprints Using Amazon S3 (35)
01.Consistent Hashing04.Distributed Caching Patterns & Eviction05.Message Queues vs. Event Streams06.Distributed Locks & Leases07.Write-Ahead Log (WAL) & LSM-Trees08.Database Sharding & Partition Keys09.Distributed Consensus (Raft & Paxos)10.Two-Phase Commit (2PC) & Saga Orchestration23.Event Sourcing & CQRS Architecture24.Cloud Disaster Recovery & Multi-Region Active-Active26.Honeypot Fields & Canary Traps27.Disposable Email & Domain Blocklists01-01:Design a Distributed Key-Value Store01-03:Design a Distributed Message Queue01-05:Design a Distributed URL Shortener (TinyURL)02-01:Design a Scalable News Feed System02-02:Design a Real-Time Chat & Instant Messaging System02-03:Design a Real-Time Gaming Leaderboard02-04:Design a Scalable Distributed Notification System03-01:Design S3-Like Distributed Object Storage03-02:Design a Search Autocomplete System03-03:Design a Web Crawler at Scale03-04:Design a Distributed Metrics Monitoring & Alerting System03-05:Design a Distributed Job Scheduler & Task Execution Queue04-01:Design a Payment Processing System04-02:Design a Digital Wallet System05-02:Design Google Maps & Distributed Routing Engine05-03:Design Nearby Friends Real-Time Location Service05-04:Design a Real-Time Ride-Sharing Dispatch Service (Uber/Lyft)06-01:Design YouTube Video Streaming Platform06-02:Design Google Drive File Sync & Storage06-03:Design Real-Time Ad Click Event Aggregation06-04:Design a Distributed Email Service07-01:Design Mobile News Feed with Offline-First Architecture07-02:Design Mobile Chat Client Architecture

Amazon SQS

Messaging & Streaming
Target Anchor: #sqs
Sub-10ms delivery latency

Fully managed distributed message queuing service providing asynchronous decoupling, point-to-point worker dispatch, strict ordering with MessageGroupId, and () containment.

Key Architectural Patterns & Primitives

Asynchronous Worker Decoupling: Ingestion gateways write to , allowing asynchronous worker fleets to consume at safe database capacities.
Partitioning: Setting MessageGroupId to entity IDs (e.g. user_id) maintains strict sequential processing per entity while scaling horizontally across groups.
() with Redrive: Isolating poison-pill messages after maxReceiveCount failures for manual diagnosis and automated redrive.
Long Polling (WaitTimeSeconds = 20): Eliminates empty-receive API calls, lowering costs and latency.
High Availability & Replication

Multi-AZ redundant message store with configurable message retention (1 minute to 14 days).

Production Pitfalls & Memory Tuning
  • Always configure Visibility Timeout greater than maximum worker processing duration (e.g. 6x Lambda timeout) to prevent duplicate concurrent executions.
  • Set unique MessageDeduplicationId for to ensure exactly-once deduplication across 5-minute rolling windows.
  • Attach CloudWatch alarms on ApproximateNumberOfMessagesVisible to trigger horizontal Auto Scaling on consumer worker fleets.

Amazon SNS

Messaging & Streaming
Target Anchor: #sns
Sub-second delivery

High-throughput Pub/Sub messaging service for 1-to-many multicast fanout to queues, Lambda functions, HTTP webhooks, and mobile push notifications (APNs / FCM).

Key Architectural Patterns & Primitives

Pub/Sub Fanout Pattern: Single publisher sends an event to an topic; replicates and broadcasts to multiple subscribed queues (billing, analytics, fraud).
Message Filtering: Subscribers define JSON filter policies on message attributes so consumers receive only relevant sub-events.
Mobile Push & SMS Gateway: Direct delivery to iOS, Android, and SMS endpoints with retry backoff.
High Availability & Replication

Multi-AZ topic replication with automatic subscriber retry and routing on delivery failure.

Production Pitfalls & Memory Tuning
  • Combine with (-to- fanout) rather than calling HTTP endpoints directly to prevent slow subscriber from dropping events.
  • Configure on individual subscriptions to catch delivery failures to endpoints.
  • Use topics paired with when strict global or group message ordering must be preserved across fanout.

Amazon Kinesis Data Streams

Messaging & Streaming
Target Anchor: #kinesis
Sub-second (< 200ms standard / < 70ms with Enhanced Fan-Out)

Real-time streaming data ingestion platform designed for high-throughput partitioned log processing, financial ticker streams, ad-click tracking, and time-series telemetry.

Key Architectural Patterns & Primitives

Sharded Partition Log: Hash map records to deterministic shards, guaranteeing sequential ordering per entity.
Enhanced Fan-Out (EFO): Dedicated 2 MB/s HTTP/2 push pipes per consumer group, allowing multiple independent real-time applications to read simultaneously without throttling.
Apache Flink Streaming Analytics: Native integration with Managed Service for Apache Flink for tumbling/sliding window aggregations.
High Availability & Replication

Synchronous replication across 3 AZs; partition log replayable by independent consumer offsets.

Production Pitfalls & Memory Tuning
  • Avoid low-cardinality that overload a single shard (1,000 records/s or 1 MB/s write limit per shard).
  • Use Producer Library (KPL) with aggregation and collection to pack multiple user records into single 1MB chunks to maximize shard efficiency.
  • Set Lambda Event Source Mapping BisectBatchOnFunctionError = true to isolate poison records without stalling entire shard consumers.

Amazon MSK

Messaging & Streaming
Target Anchor: #msk
Low single-digit millisecond (< 5ms)

Fully managed service providing high-throughput event streaming, native APIs, open-source ecosystem compatibility ( Connect, Flink, Schema Registry), and multi-region replication.

Key Architectural Patterns & Primitives

Enterprise Microservice Event Spine: High-throughput log aggregation and decoupled domain event sourcing across hundreds of microservices.
Connect: Managed Connect worker clusters for zero-code data ingestion into data lakes, , and .
Replicator: Active-Active / Active-Passive cross-region multi-cluster topic replication.
High Availability & Replication

Multi-AZ broker deployment with configurable min.insync.replicas and replication factor 3.

Production Pitfalls & Memory Tuning
  • Configure producer acks=all and enable idempotence (enable.idempotence=true) for zero message loss and duplicate prevention.
  • Monitor consumer group lag (records-lag-max) with CloudWatch alarms to scale consumer workers proactively.
  • Size partition counts based on expected peak consumer concurrency (partitions >= consumer tasks).

AWS Step Functions

Workflow & Orchestration
Target Anchor: #step-functions
Sub-second state transitions; Express workflows < 50ms

Serverless visual workflow orchestrator built for distributed Saga transactions, long-running business processes, microservice coordination, automated retries, and compensation rollbacks.

Key Architectural Patterns & Primitives

Distributed Saga Orchestrator: Central state machine coordinating multi-step transactions across Lambda, ECS, and external APIs with explicit Catch compensation blocks.
Task Token Callback (.waitForTaskToken): Pauses execution until an external worker or human approval completes and returns the callback token.
Map State in Distributed Mode: High-concurrency parallel batch processing over millions of objects or items.
High Availability & Replication

Fully managed regional state machine execution with exactly-once state transition logging.

Production Pitfalls & Memory Tuning
  • Use Standard Workflows for financial/critical transactional sagas requiring visual step auditing; use Express Workflows for high-volume, short-duration data transformations.
  • Ensure all compensation actions in Catch handlers are strictly idempotent to handle retry loops safely.
  • Set explicit TimeoutSeconds on every task state to prevent stalled external API calls from blocking workflow completion.
Curriculum Blueprints Using AWS Step Functions (2)

Amazon OpenSearch Service

Database
Target Anchor: #opensearch
Low single-digit millisecond query response (< 10ms)

Distributed Lucene-based search and analytics suite offering full-text search, Edge-NGram typeahead autocomplete, BM25 relevance ranking, and k-NN vector embeddings search.

Key Architectural Patterns & Primitives

Typeahead Autocomplete Engine: with Edge-NGram tokenizers and Completion Suggesters for sub-10ms prefix search.
k-NN Vector Similarity Search: () and IVF indexes for semantic RAG vector retrieval.
Tiered Data Lifecycle: Hot NVMe nodes -> UltraWarm -backed storage -> Cold storage for multi-terabyte log and document indexing.
High Availability & Replication

Primary and replica shards distributed across up to 3 Availability Zones with dedicated master nodes.

Production Pitfalls & Memory Tuning
  • Set primary shard count at index creation based on target shard sizes of 30GB–50GB for search workloads (10GB–30GB for logs).
  • Use Ingestion (OSI) or Streams with Lambda to decouple database writes from search indexing.
  • Deploy 3 dedicated Cluster Manager nodes in production to prevent consensus failures.

Amazon API Gateway

Networking & Edge
Target Anchor: #api-gateway
Sub-10ms proxy overhead

Serverless API ingress proxy managing REST, HTTP, and WebSocket APIs with built-in token-bucket rate limiting, JWT/Lambda authorizers, request validation, and WebSocket connection tracking.

Key Architectural Patterns & Primitives

WebSocket Connection Manager: Manages persistent bidirectional TCP connections at the edge; pushes messages asynchronously via @connections API.
Lambda / JWT Authorizers: Validates bearer tokens at the perimeter and caches IAM authorization policies for 300 seconds.
Token-Bucket Throttling & Usage Plans: Protects downstream microservices by enforcing burst and steady-state rate limits per client API key.
High Availability & Replication

Multi-AZ managed ingress with CloudFront integration for Edge-optimized distributions.

Production Pitfalls & Memory Tuning
  • Use HTTP APIs instead of REST APIs for lightweight, latency-critical REST endpoints to reduce latency by up to 60% and cost by 70%.
  • Store WebSocket connection IDs ($context.connectionId) in with to clean up disconnected sockets cleanly.
  • Enable API Gateway caching or place CloudFront in front of REST APIs to offload repetitive GET requests.

Amazon CloudFront

Networking & Edge
Target Anchor: #cloudfront
Sub-10ms edge caching across 600+ PoPs globally

Global Content Delivery Network (CDN) with 600+ Points of Presence providing low-latency static/dynamic content delivery, Origin Shield tiering, edge compute (CloudFront Functions), and DDoS shielding.

Key Architectural Patterns & Primitives

Origin Shield: Centralized intermediate caching layer between edge PoPs and application origins, reducing backend origin load by up to 80%.
CloudFront Functions: Sub-millisecond JavaScript edge compute for URL rewrites, header modifications, token validation, and normalized cache keys.
Signed URLs & Cookies: Secure time-limited media delivery and private content gating for video streaming platforms.
High Availability & Replication

Globally distributed Anycast edge network with regional edge caches (REC).

Production Pitfalls & Memory Tuning
  • Configure Cache-Control headers (max-age, s-maxage, stale-while-revalidate) to maximize cache hit ratio (> 95%) and minimize egress bandwidth costs.
  • Always forward only required query strings and headers in Cache Policies to avoid cache key fragmentation.
  • Combine with AWS WAF attached directly at CloudFront edge to block malicious traffic before it reaches regional VPCs.

Amazon Route 53

Networking & Edge
Target Anchor: #route-53
Sub-20ms global DNS resolution

Highly available authoritative DNS service providing latency-based routing, geolocation routing, synthetic health check failovers, and Application Recovery Controller (ARC) for multi-region disaster recovery.

Key Architectural Patterns & Primitives

Latency-Based & Geolocation Routing: Automatically directs global users to the AWS region offering the lowest round-trip network latency.
Application Recovery Controller (ARC): Coordinated multi-region routing control flags and readiness checks for automated zero-downtime disaster recovery.
DNS Health Check Failover: Automatically updates DNS A/ALIAS records away from degraded regional endpoints within seconds.
High Availability & Replication

Globally distributed Anycast DNS network with 100% availability .

Production Pitfalls & Memory Tuning
  • Use Alias records instead of CNAME records for apex domains (example.com) to benefit from free Route 53 queries to AWS resources (CloudFront, ALBs).
  • Set short TTLs (60s) on failover records to accelerate client DNS cache invalidation during disaster recovery events.
  • Use Route 53 Resolver for hybrid cloud DNS resolution between on-premises datacenters and AWS VPCs.

AWS WAF & AWS Shield

Security & Governance
Target Anchor: #waf
Sub-millisecond inline packet inspection (< 1ms)

Layer 7 web application firewall and DDoS protection protecting web applications against SQL injection, cross-site scripting (XSS), bot scrapers, and volumetric layer 3/4/7 DDoS attacks.

Key Architectural Patterns & Primitives

Rate-Based IP Throttling: Automatically blocks or CAPTCHAs client IP addresses issuing more than X requests per 5 minutes to prevent brute-force attacks.
AWS Managed Rules (AMR): Pre-configured, automatically updated rule sets protecting against OWASP Top 10 vulnerabilities.
Shield Advanced DDoS Response: 24/7 AWS Shield Response Team (SRT) engagement and financial cost protection for scaling during DDoS attacks.
High Availability & Replication

Integrated natively at CloudFront edge POPs, Application Load Balancers, and API Gateways.

Production Pitfalls & Memory Tuning
  • Deploy WAF in Count Mode first when introducing new rule sets to analyze false-positive rates before switching to Block.
  • Use custom response bodies (HTTP 429 Too Many Requests with JSON payload) for cleaner API client error handling.
  • Inspect customized headers (e.g. x-forwarded-for) with trusted proxy counts when WAF is deployed behind intermediate reverse proxies.

AWS Lambda

Compute & Containers
Target Anchor: #aws-lambda
Sub-millisecond execution start (warm) / 50–300ms cold start

Event-driven serverless compute engine running code in response to queues, streams, uploads, and API Gateway requests with automatic horizontal scaling and zero idle cost.

Key Architectural Patterns & Primitives

Stream & Queue Event Source Mapping: Managed poller batches records from , Streams, and with automatic checkpointing and retry logic.
RDS Proxy Connection Multiplexing: Eliminates relational database connection exhaustion during high-concurrency Lambda execution bursts.
Async Fanout Worker Fleets: Event-driven background processing (video transcoding DAG(Directed Acyclic Graph) triggers, thumbnail generators, email dispatchers).
High Availability & Replication

Multi-AZ serverless execution fleet with automated container recycling.

Production Pitfalls & Memory Tuning
  • Initialize heavy clients (AWS SDKs, database pools) outside the event handler in global scope to reuse connections across warm invocations.
  • Use AWS Graviton2/3 (arm64 architecture) for up to 34% better price-performance over x86.
  • Configure Reserved Concurrency on critical functions to prevent unthrottled batch workers from exhausting account-wide concurrency limits.

Amazon ECS Fargate

Compute & Containers
Target Anchor: #ecs-fargate
Sub-millisecond internal microservice communication

Serverless container management service running Docker microservice fleets without managing underlying EC2 server infrastructure, featuring native AWS VPC networking and target-tracking auto-scaling.

Key Architectural Patterns & Primitives

Stateless Core Microservices: High-throughput Go, Node.js, C#, or Java backends running behind Application Load Balancers.
Target Tracking Auto-Scaling: Dynamic task scaling based on ALB RequestCountPerTarget and CPU/Memory utilization thresholds.
Secure VPC Task Networking: Each Fargate task receives a dedicated Elastic Network Interface (awsvpc mode) with fine-grained Security Groups.
High Availability & Replication

Multi-AZ task placement strategies with automatic unhealthy container replacement.

Production Pitfalls & Memory Tuning
  • Set proper container stop timeouts (stopTimeout = 30s) and deregistration delays on ALBs to ensure clean HTTP connection draining during deployments.
  • Use AWS Secrets Manager integration in Task Definitions to inject secrets as environment variables securely at container startup.
  • Utilize Fargate Spot for non-critical, fault-tolerant background worker fleets for up to 70% cost reduction.

Amazon MemoryDB for Redis

Database
Target Anchor: #memorydb
Microsecond read latency (< 100µs); low single-digit ms write

Durable, in-memory database built for OSS compatibility with an immutable Multi-AZ transaction log, delivering ultra-fast performance with zero data loss on node failovers.

Key Architectural Patterns & Primitives

Durable Primary In-Memory Database: Used when workloads demand speed and complex data structures (ZSETs, Bitmaps) but cannot tolerate data loss on primary failover.
High-Frequency Financial Ledgers: Ultra-low-latency order book matching and atomic balance reservation with ACID persistence.
Real-Time Session & Auth State: High-throughput session storage that survives node crashes without database repopulation.
High Availability & Replication

Multi-AZ distributed write transaction log; writes committed to durable storage before acknowledgment.

Production Pitfalls & Memory Tuning
  • Use MemoryDB when you need as your primary durable database; use when is a transient cache in front of Aurora/DynamoDB.
  • Account for slightly higher write latency (1-3ms) compared to due to Multi-AZ synchronous transaction log persistence.
  • Cluster mode is always enabled in MemoryDB; ensure client libraries (ioredis, -py) have cluster support enabled.

AWS AppSync

Networking & Edge
Target Anchor: #appsync
Sub-10ms GraphQL query execution

Fully managed GraphQL service and real-time WebSocket Pub/Sub engine with direct resolvers, offline delta synchronization, and automated conflict resolution for mobile clients.

Key Architectural Patterns & Primitives

GraphQL Subscriptions: Real-time data push to mobile and web clients over managed WebSocket channels with zero backend server fleets.
Offline Sync & Conflict Resolution: Delta sync with built-in Optimistic Concurrency Control (OCC) and Auto-Merge algorithms for offline mobile apps.
Direct Resolvers: Execute NoSQL queries and mutations directly without intermediary Lambda compute overhead.
High Availability & Replication

Multi-AZ managed GraphQL infrastructure with WebSocket connection tiering.

Production Pitfalls & Memory Tuning
  • Use JavaScript (APPSYNC_JS) runtime resolvers instead of VTL (Velocity Template Language) for easier debugging and unit testing.
  • Implement field-level authorization directives (@auth) with Amazon Cognito User Pools for fine-grained multi-tenant security.
  • Configure caching on frequently queried GraphQL query fields to reduce backend read capacity consumption.
Curriculum Blueprints Using AWS AppSync (1)

A comprehensive, production-grade guide to designing large-scale distributed systems using Amazon Web Services (AWS) as the primary cloud architecture standard. This guide maps core system design primitives, high-availability patterns, data storage engines, and messaging topologies directly to AWS managed services.


🏛️ Master System Design Primitive to AWS Service Matrix

System Design PrimitivePrimary AWS Managed ServiceSecondary / Self-Managed OptionProduction Architecture Pattern & Use Case
DNS & Traffic RoutingAmazon Route 53AWS Global AcceleratorLatency-based routing, Geo-DNS, Failover health checks, Anycast IP routing
Edge CDN & CachingAmazon CloudFrontCloudFront Functions / Lambda@EdgeStatic asset caching, dynamic edge compute, SSL termination, origin shield
DDoS & Web SecurityAWS WAF & AWS ShieldAWS Network FirewallRate-limiting rules, SQLi/XSS filtering, Layer 3/4/7 DDoS protection
API Gateway & IngressAmazon API Gateway (REST / HTTP / WebSocket)Application Load Balancer (ALB) / Network Load Balancer (NLB)Edge authentication (Lambda Authorizers), rate-limiting usage plans, WebSocket connection management, pass-through
Serverless ComputeAWS LambdaAWS FargateEvent-driven microservices, asynchronous queue/stream consumers, scale-to-zero workloads
Container ComputeAmazon ECS / Amazon EKSAmazon EC2 (Auto Scaling Groups)Long-running microservices, high-throughput backends, distributed worker fleets
Distributed Key-Value Store on Amazon EC2Single-digit millisecond NoSQL, , Global Tables (multi-region active-active)
In-Memory Caching ( / Memcached)Amazon MemoryDB for , , Sorted Sets (leaderboards), Pub/Sub, multi-AZ failover
Relational OLTP Database ( / MySQL)Amazon RDS Multi-AZCloud-native distributed storage engine (6-way replication across 3 AZs), Global Database, Serverless v2
Object Storage & Data Lake (Standard / Glacier / Intelligent-Tiering) Express One Zone11 9s durability, multipart uploads, presigned URLs, cross-region replication (CRR), lifecycle policies
Point-to-Point Messaging (Standard & ) on Amazon MQAsynchronous decoupling, message deduplication IDs, visibility timeouts, Dead-Letter Queues ()
Pub/Sub NotificationAmazon EventBridgeTopic-based multicast fanout to queues, mobile push (APNs/FCM), SMS, and email (SES)
Distributed Event StreamingAmazon (Managed Streaming for )High-throughput ordered event ingestion, replayable partition logs, stream consumer groups
Event Bus & ChoreographyAmazon EventBridgeSchema Registry, content-based rule filtering, SaaS integration, decoupling microservice events
Distributed Temporal on EKSVisual workflow state machines, retry policies, catch handlers, compensation tasks for distributed rollbacks
Full-Text & Autocomplete SearchAmazon Self-hosted on EKS, prefix autocomplete (Edge-NGram / Completion Suggester), BM25 ranking, k-NN vector search
Geospatial Processing PostGIS / Amazon Location Service Geo LibraryR-Tree / GiST indexing, ST_DWithin radius queries, routing engine APIs, geofencing
() Streams / AWS DMSDebezium on Real-time database changelog capture, downstream cache invalidation, search index synchronization
Distributed Locking & Leases Lock ClientRedis Redlock on Heartbeated leases, conditional writes (attribute_not_exists), optimistic concurrency control
Secrets & EncryptionAWS Secrets Manager & AWS KMSAWS Systems Manager Parameter StoreEnvelope encryption (CMK / DEK), automated secret rotation, hardware security modules (HSM)

🏗️ Core Production Architecture Archetypes

Archetype 1: High-Throughput Read-Heavy Platform (e.g., News Feed, Catalogs)

Interactive Architecture Diagram
Synthesizing vector architecture diagram...

Key Architectural Rules:

  1. Edge Offloading: Static images and pre-rendered payloads cached in CloudFront.
  2. Pattern: Services query first; on miss, read from Aurora Read Replicas and populate cache with + .
  3. Database Scaling: Read replicas auto-scale based on CPU / connection metrics.

Archetype 2: High-Throughput Write-Heavy Ingestion (e.g., Metrics, Ad Clicks, IoT)

Interactive Architecture Diagram
Synthesizing vector architecture diagram...

Archetype 3: Mission-Critical Financial & Transactional (e.g., Payments, Wallets)

Interactive Architecture Diagram
Synthesizing vector architecture diagram...

⚠️ AWS Cloud Anti-Patterns & Common Scalability Pitfalls

AWS ServiceProduction Anti-Pattern / MistakeReal-World Failure ImpactProduction Best Practice & Solution
Monotonically increasing (e.g., timestamp 2026-09-04 12:00:00)Single partition throttles (1,000 WCU1,000\text{ WCU} limit); remaining cluster sits idleApply Write Sharding / (timestamp#0..9)
Querying with high-selectivity FilterExpressionReads entire table/partition before filtering, consuming immense and timing outRedesign / or create a ()
Uploading millions of files under a single static prefix (s3://bucket/data/file1.jpg)Hits prefix throughput limit (3,500 PUT/5,500 GET/s3,500\text{ PUT} / 5,500\text{ GET/s})Distribute prefixes using hash suffixes (s3://bucket/data/<hash>/file1.jpg)
AWS LambdaOpening new database connections inside handler without poolingExhausts relational database connection pools within secondsUse Amazon RDS Proxy for connection multiplexing and pooling
Setting a single MessageGroupId for all messagesSerializes entire queue to a single consumer, capping throughput at 300 msg/sSet granular MessageGroupId (e.g. user_id or order_id)
Running long analytical batch queries directly on writer nodeSqueezes buffer pool RAM, blocking transactional OLTP writesRoute analytical SQL to Aurora Read Replicas or data lake via Athena

💰 AWS Production Cost Optimization Playbook

  1. Graviton3 Compute: Migrate ECS Fargate, Lambda, and Aurora instances to AWS Graviton (ARM64) for 20%20\% better performance and 20%20\% lower cost.
  2. Intelligent-Tiering: Automatically transition objects between Frequent, Infrequent, and Archive Instant Access tiers, saving up to 68%68\% on storage costs with zero operational overhead.
  3. DynamoDB On-Demand vs. Provisioned Auto-Scaling:
    • Use On-Demand for unpredictable or bursty workloads.
    • Use Provisioned Auto-Scaling with Reserved Capacity for steady-state workloads (>50%> 50\% cost reduction).
  4. CloudFront Caching Optimization: Maximize cache hit ratios (>95%> 95\%) to reduce expensive EC2/ALB data transfer egress fees.

🌍 Multi-Region High Availability & Zero-Downtime DR Runbook

Interactive Architecture Diagram
Synthesizing vector architecture diagram...

Failover Execution Steps:

  1. Health Check Failure: Route 53 ARC detects regional outage in us-east-1.
  2. DNS Shift: Route 53 shifts 100% of ingress traffic to us-west-2 edge POPs.
  3. Aurora Promotion: Execute Aurora Global Database failover (aws rds failover-global-cluster) to promote us-west-2 read replica to primary writer in <1 minute< 1\text{ minute}.
  4. DynamoDB Continuity: DynamoDB Global Tables accept writes immediately in us-west-2 with zero manual failover steps.

⚡ AWS Managed Services Deep-Dive Reference

<a id="elasticache"></a> Amazon ElastiCache (Redis OSS & Memcached)

  • Primary Category: In-Memory Caching & Real-Time Data Store
  • Latency : Sub-millisecond read and write latency (<1 ms< 1\text{ ms} ); scales to 500k+500\text{k+} per node.
  • Architectural Mechanics:
    • (Lazy Loading): Application inspects first; on miss, loads from / DynamoDB and writes key back with + randomized .
    • Redis Sorted Sets (ZSET): Real-time leaderboard ranking (O(logN)O(\log N) insertions and ZREVRANGE retrievals).
    • Redis Pub/Sub: Ephemeral multicast message broadcasting across WebSocket edge fleets.
    • Distributed Locks & Leases: Atomic lease acquisition (SET key token NX PX 30000) with .
  • High Availability & Failover: Mode Enabled with up to 500 shards and Multi-AZ automatic failover (<30 s< 30\text{ s}). Global Datastore provides cross-region replication with <1 s< 1\text{ s} lag.
  • Production Gotchas & Memory Tuning:
    • Always reserve 25%25\% of instance RAM (reserved-memory-percent = 25) to prevent Out-Of-Memory (OOM) failures during Redis background snapshotting (BGSAVE).
    • Configure volatile-lru or allkeys-lru eviction policies depending on whether keys have explicit expiration TTLs.

<a id="dynamodb"></a> Amazon DynamoDB

  • Primary Category: Distributed NoSQL Key-Value & Document Database
  • Latency : Single-digit millisecond latency (<5 ms< 5\text{ ms} ) at any scale; microsecond latency with ().
  • Architectural Mechanics:
    • : Co-locating heterogeneous entity types in a single table using generic ( / ) and () for O(1)O(1) single-partition queries.
    • DynamoDB Streams: Ordered () 24-hour log for downstream search index synchronization, cache invalidation, and asynchronous fanout.
    • Idempotency Gate & Conditional Writes: attribute_not_exists(idempotency_key) preventing duplicate credit card charges and race conditions.
    • Global Tables: Active-Active multi-region replication with automatic Last-Writer-Wins (LWW) conflict resolution.
  • Production Gotchas & Tuning:
    • Avoid monotonically increasing (e.g. timestamps) which cause single-partition throttling (1,000 WCU/3,000 RCU1,000\text{ WCU} / 3,000\text{ RCU} limit). Apply write sharding / (pk#0..9).

<a id="aurora"></a> Amazon Aurora (PostgreSQL / MySQL)

  • Primary Category: Cloud-Native Relational OLTP Database
  • Latency : Low single-digit millisecond (<3 ms< 3\text{ ms} ); up to 5×5\times standard MySQL and 3×3\times standard throughput.
  • Architectural Mechanics:
    • Log-Structured Storage: Separates compute from storage; database engine writes only REDO logs across a 6-way replicated storage fleet across 3 AZs.
    • Aurora Global Database: Hardware storage-level cross-region replication with <1 s< 1\text{ s} lag and zero compute penalty on the primary writer.
    • Aurora Serverless v2: Instant sub-second scaling in fine-grained Aurora Capacity Units (ACUs) for volatile transaction spikes.
  • Production Gotchas & Tuning:
    • Always deploy Amazon RDS Proxy when connecting from AWS Lambda to pool and multiplex database connections.
    • Offload heavy analytical queries to dedicated Auto-Scaled Aurora Read Replicas.

<a id="s3"></a> Amazon S3 (Simple Storage Service)

  • Primary Category: High-Durability Distributed Object Storage & Data Lake
  • Latency : Single-digit ms (S3 Express One Zone) / 50-100ms first-byte (Standard); 99.999999999%99.999999999\% (11 9s) durability.
  • Architectural Mechanics:
    • Multipart Chunked Uploads: Concurrent multi-part uploads for large files (>100 MB> 100\text{ MB}) with checksum verification.
    • Presigned URLs: Direct client-to-S3 uploads/downloads bypassing application API compute servers.
    • Intelligent-Tiering: Automated lifecycle data movement across Frequent, Infrequent, and Archive tiers saving up to 68%68\% storage cost.
  • Production Gotchas & Tuning:
    • Partition high-throughput object keys with hash prefixes to scale past the default 3,500 PUT/5,500 GET/s3,500\text{ PUT} / 5,500\text{ GET/s} per prefix limit.

<a id="sqs"></a> Amazon SQS (Simple Queue Service)

  • Primary Category: Managed Distributed Message Queuing
  • Latency : Sub-10ms delivery latency; unlimited standard throughput; up to 3,000 msg/s3,000\text{ msg/s} with batching.
  • Architectural Mechanics:
    • Asynchronous Worker Decoupling: Buffers bursty traffic to protect downstream databases and services.
    • with MessageGroupId: Strict sequential ordering per entity group while scaling horizontally across partitions.
    • Dead-Letter Queues (): Automatic isolation of poison-pill messages after maxReceiveCount failures.
  • Production Gotchas & Tuning:
    • Set Visibility Timeout to 6×6\times Lambda function timeout to prevent premature message visibility and duplicate concurrent processing.

<a id="sns"></a> Amazon SNS (Simple Notification Service)

  • Primary Category: High-Throughput Pub/Sub Topic Multicast
  • Latency : Sub-second message delivery with virtually unlimited subscriber fanout capacity.
  • Architectural Mechanics:
    • Fanout Topology: Single publisher writes to an topic; broadcasts the message to multiple subscribed queues (billing, fraud, analytics).
    • Message Attribute Filtering: Subscribers receive only matching event subsets without processing unneeded messages.

<a id="kinesis"></a> Amazon Kinesis Data Streams

  • Primary Category: Real-Time Ordered Event Streaming Ingestion
  • Latency SLA: Sub-second delivery (<200 ms< 200\text{ ms} standard / <70 ms< 70\text{ ms} with Enhanced Fan-Out).
  • Architectural Mechanics:
    • Sharded Partition Log: Deterministic hash guarantee sequential ordering per entity (user_id, device_id).
    • Enhanced Fan-Out (EFO): Dedicated 2 MB/s2\text{ MB/s} HTTP/2 push pipes per consumer group without throttling.
    • Managed Apache Flink: Real-time sliding/tumbling window aggregations for ad-click metrics and telemetry.

<a id="msk"></a> Amazon MSK (Managed Streaming for Apache Kafka)

  • Primary Category: Enterprise Managed Streaming Platform
  • Latency SLA: Low single-digit millisecond (<5 ms< 5\text{ ms}); millions of events per second with high partition concurrency.
  • Architectural Mechanics:
    • Enterprise Event Spine: High-throughput microservice event sourcing and log aggregation.
    • Connect & Replicator: Zero-code integration with S3/OpenSearch and active-active cross-region topic replication.

<a id="step-functions"></a> AWS Step Functions

  • Primary Category: Serverless Visual Workflow & Saga Orchestrator
  • Latency SLA: Sub-second state transitions (Standard) / <50 ms< 50\text{ ms} execution overhead (Express).
  • Architectural Mechanics:
    • Distributed Saga Orchestrator: Central state machine coordinating multi-step transactions across Lambda, ECS, and Stripe with explicit Catch compensation blocks.
    • Task Token Callback (.waitForTaskToken): Pauses execution until an external worker or approval returns a token.

<a id="opensearch"></a> Amazon OpenSearch Service

  • Primary Category: Distributed Full-Text Search, Analytics & Vector Database
  • Latency SLA: Low single-digit millisecond query response (<10 ms< 10\text{ ms}).
  • Architectural Mechanics:
    • Edge-NGram Typeahead: Sub-10ms prefix search autocomplete with typo tolerance and BM25 ranking.
    • k-NN Vector Similarity Search: and IVF graph vector indexes for semantic retrieval and RAG architectures.

<a id="api-gateway"></a> Amazon API Gateway

  • Primary Category: Serverless API Ingress, Proxy & WebSocket Manager
  • Latency SLA: Sub-10ms proxy overhead; handles tens of thousands of concurrent connections.
  • Architectural Mechanics:
    • WebSocket Connection State: Manages persistent bidirectional TCP connections at the edge; pushes messages asynchronously via @connections API.
    • Lambda Authorizers: Edge JWT token validation with 300s IAM policy caching.
    • Token-Bucket Throttling: Burst and steady-state rate limiting per API key.

<a id="cloudfront"></a> Amazon CloudFront

  • Primary Category: Global Content Delivery Network (CDN) & Edge Security
  • Latency SLA: Sub-10ms edge caching across 600+ PoPs worldwide.
  • Architectural Mechanics:
    • Origin Shield: Intermediate caching layer reducing backend origin load by up to 80%80\%.
    • CloudFront Functions: Sub-millisecond JavaScript edge compute for URL rewrites and normalized cache keys.
    • Signed URLs / Cookies: Tokenized private media delivery for video streaming platforms.

<a id="route-53"></a> Amazon Route 53

  • Primary Category: Authoritative DNS & Intelligent Traffic Router
  • Latency SLA: Sub-20ms global DNS resolution; 100%100\% SLA availability.
  • Architectural Mechanics:
    • Latency-Based & Geolocation Routing: Directs users to the closest healthy AWS region.
    • Application Recovery Controller (ARC): Multi-region routing controls for zero-downtime disaster recovery.

<a id="waf"></a> AWS WAF & AWS Shield

  • Primary Category: Layer 7 Web Application Firewall & DDoS Mitigation
  • Latency SLA: Sub-millisecond inline packet inspection (< 1ms).
  • Architectural Mechanics:
    • Rate-Based IP Throttling: Automatically blocks client IP addresses issuing >X> X requests per 5 minutes.
    • Managed OWASP Top 10 Rule Sets: Filters SQL injection and XSS before requests reach backend compute.

<a id="aws-lambda"></a> AWS Lambda

  • Primary Category: Event-Driven Serverless Compute Engine
  • Latency SLA: Sub-millisecond execution start (warm) / 50–300ms cold start.
  • Architectural Mechanics:
    • Stream/Queue Event Source Mapping: Managed polling from SQS, DynamoDB Streams, and with automatic batching.
    • RDS Proxy Connection Multiplexing: Eliminates database connection pool exhaustion during concurrency bursts.

<a id="ecs-fargate"></a> Amazon ECS Fargate

  • Primary Category: Serverless Container Management & Microservice Orchestration
  • Latency SLA: Sub-millisecond internal microservice communication.
  • Architectural Mechanics:
    • Stateless Microservice Fleets: High-throughput Go, Node.js, C#, or Java backends behind ALBs.
    • Target Tracking Auto-Scaling: Dynamic container scaling based on ALB RequestCountPerTarget.

<a id="memorydb"></a> Amazon MemoryDB for Redis

  • Primary Category: Durable In-Memory Database with Redis OSS API Compatibility
  • Latency SLA: Microsecond read latency (< 100µs); low single-digit ms write.
  • Architectural Mechanics:
    • Multi-AZ Transaction Log: Writes committed to an immutable Multi-AZ transaction log before acknowledgment, delivering Redis speed with zero data loss.

<a id="appsync"></a> AWS AppSync

  • Primary Category: Managed GraphQL & Real-Time WebSocket Pub/Sub
  • Latency SLA: Sub-10ms GraphQL query execution.
  • Architectural Mechanics:
    • GraphQL Subscriptions: Real-time push to mobile and web clients over managed WebSocket channels.
    • Offline Delta Sync & Conflict Resolution: Built-in Optimistic Concurrency Control (OCC) and Auto-Merge for offline mobile apps.