Courseiva
Question 278 of 724
Development with AWS ServiceshardMultiple ChoiceObjective-mapped

DVA-C02 Development with AWS Services Practice Question

A developer is building a serverless application using AWS Lambda and Amazon API Gateway. The developer wants to enable caching for API responses to reduce latency and cost. Which step is REQUIRED to enable caching?

⚠ Common exam trap

Candidates often confuse API Gateway's built-in caching with external caching solutions like ElastiCache or assume that caching can be enabled solely by modifying Lambda code or integration settings, when in fact a dedicated cache cluster must be explicitly created and enabled at the API Gateway stage level.

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

Create a cache cluster in API Gateway for the stage

API Gateway caching requires a dedicated cache cluster to be enabled and configured at the stage level. This cluster stores API responses and serves them directly from the cache for identical requests, reducing the number of calls to the backend Lambda function and lowering latency. Without creating and enabling this cache cluster in the API Gateway stage settings, caching cannot function.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • Enable caching in the Lambda function code

    Why it's wrong here

    This option is incorrect because API Gateway's built-in caching mechanism operates at the API layer, external to the Lambda function's execution environment. While a Lambda function *could* implement its own application-level caching using services like ElastiCache, the question implies leveraging API Gateway's native caching to reduce latency for API responses. Enabling caching within the Lambda function code would not utilize API Gateway's integrated caching feature, which is designed to intercept and serve responses before invoking the backend.

  • Set the TTL in the API Gateway method request integration

    Why it's wrong here

    This option is incorrect because the Time-To-Live (TTL) for API Gateway's stage-level caching is configured within the cache settings for a specific stage, not directly within the method request integration settings. The method request integration primarily defines how API Gateway maps incoming request parameters to the backend integration, such as a Lambda function. Cache settings, including TTL, cache capacity, and encryption, are distinct configurations applied to the API Gateway stage itself after caching has been enabled.

  • Create a cache cluster in API Gateway for the stage

    Why this is correct

    This is the correct approach for reducing latency by caching API responses directly within API Gateway. To enable caching, a cache cluster must be provisioned and associated with a specific API Gateway stage, where you define its capacity (e.g., 0.5 GB to 237 GB) and the default Time-To-Live (TTL) for cached responses. Once enabled, API Gateway intercepts requests, serves cached responses if available and valid, and only invokes the backend Lambda function when a cache miss occurs or the cache entry expires.

  • Use Amazon ElastiCache and modify the Lambda function to check cache

    Why it's wrong here

    Using Amazon ElastiCache requires the Lambda function to implement cache-check logic itself, whereas API Gateway caching operates at the API layer without code changes. This option is tempting because ElastiCache is a valid caching service for reducing latency in Lambda-based applications, and it would be correct if the requirement were to cache database query results or session data rather than API responses.

Quick reference

Cloud Service Model Comparison

ModelYou ManageProvider ManagesExamples
IaaSOS, runtime, apps, dataHardware, hypervisor, networkingEC2, Azure VMs, GCP Compute Engine
PaaSApps and dataOS, runtime, middleware, hardwareElastic Beanstalk, Azure App Service
SaaSData and settings onlyEverything elseMicrosoft 365, Salesforce, Workday
FaaS / ServerlessFunction code onlyInfra, scaling, runtimeLambda, Azure Functions, Cloud Run
CaaSContainers and appsKubernetes, OS, hardwareEKS, AKS, GKE

About these practice questions

Courseiva creates original exam-style practice questions with explanations and wrong-answer analysis. It does not publish real exam questions, exam dumps, or protected exam content. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

Last reviewed: Jul 4, 2026

Question Discussion

Share a tip, memory trick, or ask about the reasoning behind this question. Do not post real exam questions, leaked content, braindumps, or copyrighted exam material. Comments are moderated and may be removed without notice.

Loading comments…

Sign in to join the discussion.

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.