Caching with CloudFront and ElastiCache: SOA-C03 study notes and practice questions
What to know about Caching with CloudFront and ElastiCache for the SOA-C03 exam, from the Reliability and Business Continuity domain (22% of the exam guide), then 2 free questions to test it. Part of the SOA-C03 study guide.
Caching questions ask how to cut load on origins and databases, and why a cache isn’t helping.
CloudFront
Cache key: the URL plus any query strings, headers and cookies you include. Every extra value creates another cached copy, lowering the cache hit ratio. Include only what changes the response; use an origin request policy to send other values to the origin without adding them to the key.
TTLs come from cache policies and origin Cache-Control headers.
Invalidations remove objects early (the first 1,000 paths a month have no extra charge); versioned file names avoid invalidations.
Origin Shield adds a central caching layer, so each object is fetched from the origin once instead of once per regional edge cache.
C. Wrong: A larger instance relieves CPU, but each lookup still runs against the database and takes milliseconds. It costs more and does not give sub-millisecond reads. Learn more: DB instance classes (opens in a new tab)
D. Right: Correct. Repeated reads of data that rarely changes are ideal for an in-memory cache. ElastiCache returns results in sub-millisecond time and removes most of these queries from the database. Learn more: Caching strategies for ElastiCache (opens in a new tab)
Explanation
When a small set of queries with slowly changing results drives database load, caching them in memory is the standard fix. ElastiCache serves them in sub-millisecond time and frees the database for other work. Multi-AZ standbys do not serve reads, DAX works only with DynamoDB, and scaling up keeps every query on the database.
A public library streams recorded author talks through Amazon CloudFront from a custom origin of EC2 instances in one Region. Viewers are spread across many countries.
When a new talk is released, many edge locations request the same video segments from the origin at once, and origin CPU spikes even though the cache hit ratio at the edges is good.
The library wants to reduce the load on its origin.
What should a CloudOps engineer do?
Choose one answer.
AA. Create an origin group with a second EC2 origin so that CloudFront sends requests to it when the first origin is busy.
BB. Turn on Origin Shield in the Region closest to the origin to add a central caching layer.
CC. Lower the default TTL on the distribution's cache behavior so that edge locations refresh popular segments more often.
DD. Invalidate the new talk's segments across the distribution right after release so that every edge location caches a fresh copy.
B. Right: Correct. Origin Shield adds a central caching layer in front of the origin. Requests from many edge locations and regional caches are consolidated there, so the origin receives far fewer duplicate requests. Learn more: Use Amazon CloudFront Origin Shield (opens in a new tab)
Even with good edge hit ratios, each edge location and regional cache can fetch the same object from the origin on its first request. Origin Shield puts one more cache layer in front of the origin, so those requests collapse into one. TTL changes, invalidations and origin groups either raise origin load or address failover, not load.
Want more on Caching with CloudFront and ElastiCache? The 5 full-length practice sets have 10 more Caching with CloudFront and ElastiCache questions, 325 in all, none of them in the free exam. One payment of $14.99, no subscription. See the practice sets →