Choose the right front door—and cache only safe data
Classify protocol, routing, identity, cacheability, and freshness before choosing API Gateway, ALB, CloudFront, Global Accelerator, or an application cache.
LESSON GOALS
By the end, you can
- Choose an API, load balancer, CDN, or accelerator from the request path and protocol.
- Create separate cache and failure policies for public, inventory, and authorization-sensitive data.
01
Classify the request before choosing a front door
Begin with one request. Record its protocol, caller identity, routing rule, response deadline, peak rate, backend capacity, and whether the answer may be stale. A service name comes later.
API Gateway manages REST, HTTP, and WebSocket APIs. An Application Load Balancer routes HTTP or HTTPS to VPC targets by rules such as host or path. Both can receive HTTP, but their product boundaries are different.
Ask whether the caller needs the work to finish before receiving a response. A quick read may stay synchronous. A request that starts minutes of processing can acknowledge acceptance and place work on a queue instead of holding every connection open.
Now classify the response. Public descriptions, personalized pages, inventory, prices, and entitlements do not share one freshness rule. Write the acceptable staleness and failure behavior for each class.
The authoritative source remains the database or service that owns the record. A cache stores a reusable answer; it does not become the owner merely because it responds faster.
02
Give each front door one job
Choose CloudFront when global HTTP delivery and edge caching reduce origin work. A cache hit can answer near the viewer. A miss still reaches the origin, so the origin must handle the uncached rate.
Choose Global Accelerator when traffic is noncacheable and needs static anycast IP addresses or improved network routing to healthy Regional endpoints. It routes traffic; it does not store an HTTP response.
Choose an Application Load Balancer for Layer 7 routing to application targets in a VPC. Choose API Gateway when the requirement is a managed API boundary. Stack services only when each owns a named job.
For example, CloudFront can cache public catalog descriptions before a restricted ALB origin. Adding Global Accelerator in front of that cacheable HTTP path does not create another cache. An ALB alone balances requests but does not provide edge caching.
Close bypass paths. If clients can call the origin directly, they can avoid the edge cache, request filtering, and other controls placed at CloudFront. Test the distribution URL and the origin address separately: the intended path should work and the direct path should fail.
03
Cache only what may be stale
A cache key must include every request property that changes the answer. If identity or authorization changes the response, omitting it can show one caller another caller's data.
Set time to live, invalidation after writes, eviction behavior, and the result of cache or source failure. Public descriptions may use a bounded stale response. Inventory and entitlements should reach their authority or fail closed when stale data could sell unavailable stock or grant revoked access.
Cache-aside reads the cache first, loads the source on a miss, then populates the cache. After a restart, many simultaneous misses can stampede the origin. Coalesce work, limit retries, and watch origin concurrency rather than edge latency alone.
A replicated cache can reduce node-loss impact, but cached data is not automatically a durable record. When the cache fails, the source of truth must still define correctness and recovery.
For the catalog, 12,000 reads each second exceed the origin's safe 2,000. Cache the public descriptions with a bounded TTL and restricted origin. Keep current inventory and entitlements on an authoritative path with stricter failure behavior.
Measure hit ratio, object age, origin request rate, p95 latency, and direct-origin rejection. The design passes only when origin load stays safe without serving a stale answer where correctness forbids it.
DECISION TABLE
Compare the architecture constraints
| requirement | choose | because | reject |
|---|---|---|---|
| Global cacheable HTTP and origin offload | CloudFront | Edge caching reduces origin work | Global Accelerator does not cache |
| HTTP host/path routing to containers | ALB | Layer 7 rules fit | NLB lacks HTTP-aware rules |
| Managed REST/HTTP/WebSocket endpoint | API Gateway | API management is required | ALB alone has a different boundary |
| Repeated application reads with stale tolerance | ElastiCache cache-aside | Application controls keys and fallback | Read replica is not an object cache |
GUIDED WORKED SCENARIO
Reason from the stated constraints
This is a guided example, not a question to memorise. The knowledge check uses new situations to test the same reasoning.
A global catalog receives 12,000 reads/s. Public descriptions may be 60 seconds stale, but inventory and entitlements must be current. Origin capacity is 2,000 reads/s.
Requirements
- Keep public p95 low worldwide
- Reduce origin below 2,000 reads/s
- Never authorize or promise inventory from stale data
- Prevent direct origin bypass
Reasoning path
- Separate public descriptions from sensitive data.
- Use CloudFront with bounded TTL and restricted origin.
- Use application caching only with explicit invalidation; fail closed for sensitive classes.
- Observe uncached origin load.
Why it wins
- It shields the origin where staleness is allowed.
- It preserves correctness with separate failure policy.
Why the alternatives lose
It routes but does not cache or reduce origin requests.
Becomes correct when: Traffic is noncacheable or needs static anycast IPs.It violates inventory and authorization correctness.
Becomes correct when: All data is public and immutable for the interval.It balances but does not edge-cache.
Becomes correct when: Clients are Regional and only L7 balancing is required.INTERACTIVE ARCHITECTURE VISUAL
Route each response by its freshness rule
Switch between a public description and current inventory, then choose the edge cache or authoritative service.
× Request stopsThe route works, but stale inventory can promise stock the authority no longer has.
Read the diagram as text
A request-path table marks cache hit or miss, identity context, origin reachability, stale-data policy, and origin load for each catalog data class.
KNOWLEDGE CHECK
Answer one question at a time
Pass every question to complete this lesson. Each answer includes reasoning before you continue.
KEY TERMS
Glossary
- Front door
- The managed entry point where clients first reach an application path.
- API Gateway
- A managed service for creating and operating REST, HTTP, and WebSocket APIs.
- Application Load Balancer (ALB)
- A Layer 7 load balancer that routes HTTP and HTTPS requests to targets.
- CloudFront
- A content delivery network that can cache HTTP content near viewers.
- Global Accelerator
- A network service using static anycast IP addresses to route traffic to healthy endpoints.
- Cache key
- The request properties that identify which cached response may be reused.
- Time to live (TTL)
- How long a cached value remains eligible before it is treated as expired.
- Source of truth
- The system that authoritatively owns the current record.
- Cache stampede
- A burst of cache misses that sends too many simultaneous requests to the origin.
- Fail closed
- Deny or stop an operation when required current authorization or data is unavailable.
PRIMARY SOURCES
Verify the claims
- primaryWhat is Amazon API Gateway?aws-srv-apigw · retrieved 2026-07-29
- primaryWhat is Elastic Load Balancing?aws-compute-elb · retrieved 2026-07-29
- primaryWhat is an Application Load Balancer?aws-elb-application-load-balancer · retrieved 2026-07-30
- primaryWhat is Amazon CloudFront?aws-net-cloudfront · retrieved 2026-07-29
- primaryWhat is AWS Global Accelerator?aws-net-global-accel · retrieved 2026-07-29
- primaryWhat is Amazon ElastiCache?aws-db-elasticache · retrieved 2026-07-29