Question 1,112 of 724
DVA-C02 Troubleshooting and Optimization Practice Question
A developer is troubleshooting an Amazon API Gateway REST API that returns 504 Gateway Timeout errors for certain requests. The backend is a Lambda function that performs a resource-intensive operation that occasionally takes up to 30 seconds. API Gateway has a default integration timeout of 29 seconds. The developer cannot reduce the execution time. What should the developer do to resolve the timeout issue?
⚠ Common exam trap
Candidates often assume the integration timeout is configurable to any value, but AWS enforces a hard 29-second limit for REST APIs, making Option A technically impossible.
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
✓
Refactor the Lambda function to use asynchronous invocation, return a 202 immediately, and have the client poll for results.
It decouples the client from the long-running Lambda execution. By invoking the Lambda asynchronously, the API Gateway can return a 202 Accepted response immediately, well within the 29-second integration timeout. The client then polls a separate endpoint (e.g., using a presigned S3 URL or a DynamoDB status record) to retrieve the final result, completely sidestepping the timeout limitation.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
Increase the API Gateway integration timeout to 30 seconds.
Why it's wrong here
Increasing the API Gateway integration timeout to 30 seconds is not a viable solution because API Gateway imposes a strict maximum integration timeout of 29 seconds for all backend integrations, including Lambda functions. This is a hard limit that cannot be configured beyond 29,000 milliseconds. Any backend process exceeding this duration will inevitably result in a 504 Gateway Timeout error, regardless of the configured value attempting to surpass this ceiling.
- ✓
Refactor the Lambda function to use asynchronous invocation, return a 202 immediately, and have the client poll for results.
Why this is correct
Refactoring the Lambda function to use asynchronous invocation, returning a 202 immediately, and having the client poll for results is the correct approach for long-running operations. This pattern decouples the synchronous API Gateway request from the extended backend processing, allowing API Gateway to respond promptly with a 202 Accepted status. The Lambda function can then trigger an asynchronous workflow (e.g., via SQS, SNS, or directly invoking another Lambda asynchronously) and store results for the client to retrieve later through a separate polling mechanism, effectively bypassing the 29-second timeout.
- ✗
Enable API Gateway caching to avoid repeated calls.
Why it's wrong here
Enabling API Gateway caching primarily serves to reduce latency and backend load for repeated, identical requests by storing responses and serving them directly from the cache. While beneficial for performance optimization, caching does not address the root cause of a 504 Gateway Timeout, which indicates that the initial or unique backend processing for a request exceeded the integration timeout. Caching would only prevent the timeout if the exact same request had previously completed successfully and was cached, which is not the scenario described by a persistent 504 error.
- ✗
Use multiple Lambda functions to parallelize processing.
Why it's wrong here
Using multiple Lambda functions to parallelize processing, while potentially speeding up the overall completion of a complex task, does not inherently resolve a 504 timeout originating from the API Gateway's synchronous integration. The primary Lambda function invoked by API Gateway still operates under the 29-second timeout limit for its initial response. If the orchestration or the first critical step of the parallelized workflow still takes longer than 29 seconds to return a response to API Gateway, the 504 error will persist, as the parallelization occurs after the initial synchronous call.
Visual reference
Quick reference
AWS S3 Storage Class Comparison
| Storage Class | Min Duration | Retrieval | Use Case |
|---|---|---|---|
| S3 Standard | None | Immediate | Frequently accessed data |
| S3 Standard-IA | 30 days | Immediate | Infrequent access, rapid retrieval |
| S3 One Zone-IA | 30 days | Immediate | Non-critical infrequent data |
| S3 Intelligent-Tiering | None | Immediate–hours | Unknown or changing access patterns |
| S3 Glacier Instant | 90 days | Milliseconds | Archive with instant retrieval |
| S3 Glacier Flexible | 90 days | Minutes–hours | Archive, flexible retrieval |
| S3 Glacier Deep Archive | 180 days | Hours | Long-term compliance archive |
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 →
Last reviewed: Jun 11, 2026
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.
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.
Sign in to join the discussion.