Course menuSAP-C03

Exams / SAP-C03 / Ingress, edge functions and real-time APIs (ALB, NLB, API Gateway, CloudFront) / Question 1

SAP-C03 practice question: Ingress, edge functions and real-time APIs (ALB, NLB, API Gateway, CloudFront)

Architecture Design and Implementation Built for the Cloud A free question from our original SAP-C03 practice exam. Try it, then open the answer to see why each option is right or wrong.

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

A streaming news site serves most of its article pages from Amazon CloudFront. Readers who hold a paid subscription have a signed subscriber cookie, and non-subscribers must be redirected to the subscription page before they can read a paywalled article.

The check must run on every viewer request, including requests that CloudFront could otherwise answer from its cache. It must add almost no latency, and the team wants no network call to a subscription service on each request.

Which solution meets these requirements at the LOWEST cost?

Choose one answer.

  1. A. Attach a CloudFront Function to the viewer request event that reads the subscriber cookie and returns a redirect to the subscription page when the cookie is missing or invalid.
  2. B. Attach a Lambda@Edge function to the origin request event that checks the subscriber cookie against the subscription service.
  3. C. Move the check to the origin by placing an Application Load Balancer with an OIDC authentication action in front of the site, so every request is authenticated before it reaches the content.
  4. D. Attach a Lambda@Edge function to the viewer request event that looks up the reader's subscription status in a DynamoDB table on every request.
Show the answer and explanation

Answer: A

  • A. Right: Correct. CloudFront Functions run on every viewer request at the edge with very low latency and cost, and they can read cookies and return redirects without a network call. This covers cached and uncached requests alike.
  • B. Wrong: The origin request event runs only when CloudFront forwards a request to the origin, so cached article pages would be served without the check. The function also makes a network call on each cache miss.
  • C. Wrong: Authentication at the origin means every request, including those that could be cached, reaches the load balancer. That raises origin load and cost, and it adds latency that the edge check avoids.
  • D. Wrong: This check does run on every viewer request, so it meets the coverage need. The per-request network call to DynamoDB adds latency and cost, which breaks the requirement to add almost no latency and avoid network calls.

Explanation

The check has to run on every viewer request, with almost no latency and no network call, so the viewer request event and a CloudFront Function fit. Origin request logic misses cache hits, and the other options add origin load or a network call on every request.

Study

Keep practicing

Answer questions with a score at the end, or practice just this topic with the explanation after each one. No sign-up needed.

Want more on Ingress, edge functions and real-time APIs (ALB, NLB, API Gateway, CloudFront)? The 5 full-length practice sets have 5 more Ingress, edge functions and real-time APIs (ALB, NLB, API Gateway, CloudFront) questions, 375 in all, none of them in the free exam. One payment of $14.99, no subscription. See the practice sets