Course menuSOA-C03

Exams / SOA-C03 / Study guide / Caching with CloudFront and ElastiCache

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.

Last verified against current AWS documentation ·How we write our questions

What to know for the exam

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.
  • CloudWatch metrics: CacheHitRate (with additional metrics turned on), 4xx/5xx error rates, origin latency.

ElastiCache

Engine Strengths
Valkey / Redis OSS Replication, Multi-AZ automatic failover, persistence, backups, data structures, cluster mode for sharding
Memcached Simple, multi-threaded, no replication
  • ElastiCache Serverless scales automatically with no nodes to manage.
  • Scale reads with replicas; scale writes and memory with more shards (cluster mode).
  • Strategies: lazy loading (cache on a miss, with a TTL) or write-through (update the cache on every write).
  • Watch CPUUtilization / EngineCPUUtilization, Evictions (memory too small), CacheHits/CacheMisses and CurrConnections.

Common traps

  • Low CloudFront hit ratio caused by forwarding all headers or cookies into the cache key.
  • High evictions: the cache needs more memory, not more CPU.
  • Write-through when another system updates the database directly. Use a TTL so stale data expires.

Try the 2 practice questions

A pet insurer's quote website runs on EC2 instances that query an Amazon RDS for MySQL database.

Query analysis shows that most database load comes from the same few hundred plan-lookup queries, whose results change only once a day.

Database CPU reaches 90 percent at peak, and the team wants sub-millisecond reads for these lookups.

What should a CloudOps engineer recommend?

Choose one answer.

  1. A. Turn on Multi-AZ for the DB instance so that the standby instance serves part of the read traffic.
  2. B. Put Amazon DynamoDB Accelerator (DAX) in front of the RDS database so that repeated queries are answered from memory.
  3. C. Move the DB instance to a larger instance class so that it has more CPU to process the repeated lookups at peak.
  4. D. Add an ElastiCache cluster and cache the plan-lookup results in the application with a TTL of a few hours.
Show the answer and explanation

Answer: D

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.

Study

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.

  1. A. Create an origin group with a second EC2 origin so that CloudFront sends requests to it when the first origin is busy.
  2. B. Turn on Origin Shield in the Region closest to the origin to add a central caching layer.
  3. C. Lower the default TTL on the distribution's cache behavior so that edge locations refresh popular segments more often.
  4. D. Invalidate the new talk's segments across the distribution right after release so that every edge location caches a fresh copy.
Show the answer and explanation

Answer: B

Explanation

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.

Study

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

Study Caching with CloudFront and ElastiCache

More Reliability and Business Continuity topics