Volume 7 · Chapter 10 — Microservices and System Design
Caching Strategy and Reference Architectures
10.1 Introduction
The exam frequently asks you to design a performant, scalable architecture, and two skills recur: choosing among the many caching layers AWS offers, and recognizing the standard reference architectures (three-tier web, serverless web, decoupled). This chapter provides both, tying together services from across the series into canonical designs.
10.2 The Caching Layers and Where Each Fits
AWS offers caching at multiple layers, and knowing which to use where is a common exam theme.CloudFrontcaches static and cacheable content at the edge, closest to users - the first layer for web content and cacheable API responses.API Gateway cachingcaches API responses at the API layer.**ElastiCache (Redis/Memcached)**caches at the application/data layer - database query results, sessions, computed data - reducing load on the database.DAXcaches specifically in front of DynamoDB for microsecond reads. Additionally, read replicas scale reads at the database layer. The decision: cache as close to the user as possible for the biggest win (CloudFront for content), use ElastiCache for hot database reads, DAX for DynamoDB specifically, and API Gateway cache for cacheable API responses - layering them so each absorbs load the layer behind it would otherwise bear.
flowchart LR User((User)) --> CF[CloudFront - edge cache: content, cacheable APIs] CF --> APIGW[API Gateway + response cache] APIGW --> App[App / compute] App --> EC[ElastiCache - hot DB reads, sessions] App --> DAX[DAX - DynamoDB reads] App --> RR[(Read replicas)] App --> DB[(Database - source of truth)]
10.3 The Three-Tier Web Architecture
The classicthree-tierreference architecture: apresentation tier(Route 53 → CloudFront → an ALB in public subnets, often with WAF), anapplication tier(stateless EC2/containers in an Auto Scaling group across AZs in private subnets), and adata tier(a Multi-AZ RDS/Aurora database in private subnets, with read replicas and ElastiCache). This design embodies the core principles: multi-AZ for availability, private subnets for the sensitive tiers, stateless horizontally-scaled app tier, caching and read replicas for read scale, and edge delivery. It’s the default answer for a scalable, resilient web application and a template the exam expects you to reproduce and reason about.
10.4 The Serverless Web Architecture
Theserverlessreference architecture replaces servers with managed services:CloudFront + S3serve the static front end (single-page app),API Gateway + Lambdaprovide the backend API,DynamoDB(with DAX) stores data,Cognitohandles user authentication, andStep Functions/EventBridge/SQSorchestrate asynchronous work. This design scales automatically, costs nothing when idle, and has no servers to manage - ideal for variable or unpredictable workloads and for teams wanting minimal operational overhead. The exam pattern: S3+CloudFront for the SPA, API Gateway+Lambda+DynamoDB for the API and data, Cognito for auth - the canonical serverless web stack, contrasted with the three-tier server-based design.
10.5 Decoupled and Event-Driven Reference Patterns
For scalability and resilience, reference architectures decouple components with messaging (detailed in the messaging volume): a queue (SQS) between a producer and worker fleetload-levelsbursts and lets workers scale to the backlog;SNSorEventBridgefan an event out to many consumers; andStep Functionsorchestrate multi-step workflows. The canonical pattern is to put the minimum synchronous work in the request path and push the rest to asynchronous, decoupled processing - so the user-facing tier stays fast and the heavy work scales independently and absorbs bursts. Recognizing when to insert a queue for load-leveling, pub/sub for fan-out, or a workflow for orchestration is a core exam design skill.
10.6 Banking Production Scenario
A bank’s customer platform layers caching: CloudFront serves the SPA and cacheable content from the edge, API Gateway caches read-heavy responses, ElastiCache fronts hot database reads and sessions, and DAX accelerates a DynamoDB reference table - each layer absorbing load from the one behind it, with authoritative balances always read from the source of truth. Its main web app follows the three-tier pattern (Route 53 → CloudFront/WAF → ALB → Auto Scaling app tier → Multi-AZ Aurora with replicas), while a newer customer feature uses the serverless stack (S3+CloudFront, API Gateway+Lambda+DynamoDB, Cognito). Payments decouple via SQS for load-leveling and SNS fan-out, with Step Functions orchestrating the saga. This deliberate caching strategy and use of canonical architectures is exactly the professional-level design competence the certification targets.
10.7 Chapter Revision Notes
- Caching layers: CloudFront (edge content/cacheable APIs), API Gateway cache (API responses), ElastiCache (hot DB reads/sessions), DAX (DynamoDB), read replicas (DB read scale) - cache close to the user and layer them.
- Three-tier: Route 53 → CloudFront/WAF → ALB (public) → stateless Auto Scaling app tier (private, multi-AZ) → Multi-AZ RDS/Aurora + replicas + ElastiCache (private).
- Serverless: S3+CloudFront (SPA), API Gateway+Lambda (API), DynamoDB+DAX (data), Cognito (auth), Step Functions/EventBridge/SQS (async).
- Decouple with SQS (load-leveling), SNS/EventBridge (fan-out), Step Functions (orchestration) - minimum synchronous work, push the rest to async.
- Match the pattern to the workload: three-tier for server-based scalable web apps, serverless for variable/low-ops workloads.