DVA-C02 Development with AWS Services Practice Question
A developer is designing a serverless application that uses Amazon API Gateway and AWS Lambda. The API receives a high volume of requests, and the developer needs to cache responses to reduce latency and cost. Which TWO actions should the developer take? (Choose TWO.)
⚠ Common exam trap
Candidates often miss that CloudFront (Option C) can be placed in front of API Gateway to act as a highly cost-effective cache. They might incorrectly choose Option E, thinking that returning `Cache-Control` headers from Lambda automatically enables caching, but without a caching proxy like CloudFront, those headers only affect client-side (browser) caching and do not protect the backend from high-volume concurrent requests from different users.
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
Use Amazon CloudFront in front of API Gateway to cache responses.
Option C is correct because Amazon CloudFront can be deployed in front of API Gateway as a CDN, caching responses at edge locations to reduce latency and offload requests from the API, which lowers Lambda invocations and cost. Option D is correct because API Gateway has a built-in caching feature that can be enabled per stage or method, and setting a TTL controls how long responses are cached, directly reducing backend calls and latency. Option A is incorrect because DAX is a caching layer for DynamoDB, not for API Gateway or Lambda responses. Option B is incorrect because ElastiCache for Redis would require custom application logic to read/write the cache and is not a native API Gateway caching mechanism. Option E is incorrect because returning cache-control headers from Lambda does not by itself enable caching in API Gateway; caching must be explicitly configured on the API Gateway stage or method.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
Use DynamoDB Accelerator (DAX) to cache Lambda responses.
Why it's wrong here
DAX (DynamoDB Accelerator) is an in-memory cache specifically designed to provide microsecond response times for read-heavy workloads on Amazon DynamoDB tables. Its purpose is to cache items and query results directly from DynamoDB, making it highly specialized for that service. Consequently, DAX is not designed or integrated to cache HTTP responses generated by a Lambda function or managed by API Gateway, rendering it unsuitable for this particular caching requirement.
- ✗
Use ElastiCache for Redis to store frequently accessed responses.
Why it's wrong here
While Amazon ElastiCache for Redis is a robust, in-memory data store frequently used for caching, it does not offer a native, integrated response caching mechanism directly within API Gateway. Implementing ElastiCache for API response caching would necessitate the Lambda function itself to manage all cache interactions, including reading from and writing to Redis. This approach introduces significant complexity into the application logic and bypasses API Gateway's built-in, simpler caching features, which are designed for this exact purpose.
- ✓
Use Amazon CloudFront in front of API Gateway to cache responses.
Why this is correct
CloudFront caches at the edge location level, but API Gateway’s native caching operates at the API stage level, which is the specific requirement for reducing latency and cost within the API Gateway service itself. This option is tempting because CloudFront is commonly used to accelerate content delivery and cache static assets for web applications, and it would be the correct choice if the goal were to offload requests from the origin for a globally distributed user base rather than caching API responses at the API Gateway stage.
- ✓
Enable API Gateway caching and set a TTL for the cache.
Why this is correct
API Gateway provides a powerful, built-in caching mechanism that operates at the stage level, designed to store responses from your backend integrations, such as Lambda functions. When enabled, API Gateway serves subsequent identical requests directly from this cache, significantly reducing latency for clients and decreasing the load on your backend services, thereby lowering operational costs. Configuring a Time-To-Live (TTL) for the cache explicitly defines how long responses remain valid in the cache before they are considered stale and require re-fetching from the backend.
- ✗
Configure the Lambda function to return cache-control headers in the response.
Why it's wrong here
For API Gateway's caching to be most effective and allow for granular control, the integrated Lambda function should explicitly include appropriate `Cache-Control` headers within its HTTP responses. Headers such as `Cache-Control: max-age=300` instruct API Gateway (and any downstream caches) on the maximum duration a response can be cached before it must be revalidated or refreshed. This mechanism empowers the backend to dynamically dictate caching behavior for different responses, providing fine-grained control over cache invalidation and ensuring data freshness.
Quick reference
Cloud Service Model Comparison
| Model | You Manage | Provider Manages | Examples |
|---|---|---|---|
| IaaS | OS, runtime, apps, data | Hardware, hypervisor, networking | EC2, Azure VMs, GCP Compute Engine |
| PaaS | Apps and data | OS, runtime, middleware, hardware | Elastic Beanstalk, Azure App Service |
| SaaS | Data and settings only | Everything else | Microsoft 365, Salesforce, Workday |
| FaaS / Serverless | Function code only | Infra, scaling, runtime | Lambda, Azure Functions, Cloud Run |
| CaaS | Containers and apps | Kubernetes, OS, hardware | EKS, AKS, GKE |
Go deeper
Related to this question
About these practice questions
This DVA-C02 question is part of Courseiva's 1,135-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. Learn why practice questions differ from exam dumps →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This DVA-C02 practice question is part of Courseiva's free Amazon Web Services certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the DVA-C02 exam.