DVA-C02 Troubleshooting and Optimization Practice Question
A developer has deployed an AWS Lambda function that is triggered by an Amazon S3 event. The function processes image files and stores metadata in an Amazon DynamoDB table. CloudWatch metrics show that the function's error count has increased. The developer checks CloudWatch Logs and sees errors related to insufficient memory. The function is configured with 128 MB of memory. What should the developer do to resolve the errors?
⚠ Common exam trap
Candidates often confuse memory errors with timeout errors and incorrectly choose to increase the timeout, but the logs explicitly state insufficient memory, not duration limits.
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
✓
Increase the function's memory to 256 MB or higher.
The error is caused by insufficient memory, which directly impacts the CPU and execution resources allocated to the Lambda function. Increasing the memory allocation to 256 MB or higher provides more CPU throughput and memory, resolving the out-of-memory errors without requiring code changes.
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 function's memory to 256 MB or higher.
Why this is correct
An "out-of-memory" error directly indicates that the allocated memory for the Lambda function is insufficient to perform its operations, such as image processing which can be memory-intensive. Increasing the memory allocation directly addresses this by providing more RAM for the function to utilize during execution. Furthermore, AWS Lambda's execution environment scales CPU power proportionally with memory allocation, meaning higher memory also grants more vCPUs, accelerating image processing and reducing overall execution time.
- ✗
Increase the function's timeout to 30 seconds.
Why it's wrong here
Increasing the function's timeout only extends the maximum duration a Lambda function is allowed to run before being forcibly terminated by the service. An "out-of-memory" error signifies that the function ran out of available RAM, causing it to crash immediately, regardless of the remaining timeout period. Extending the timeout would not provide additional memory resources to prevent the initial memory exhaustion, thus failing to resolve the root cause of the error.
- ✗
Reduce the size of the images being uploaded to S3.
Why it's wrong here
While reducing the size of images would decrease the memory required for processing, it is not a robust or scalable solution for a Lambda function designed to process S3 uploads. This approach shifts the burden to the upstream process or users, which is often impractical or impossible to control in real-world scenarios. A well-designed Lambda function should be configured to handle the expected range of input sizes, and modifying the source data is an operational workaround rather than a proper architectural fix for a memory constraint.
- ✗
Move the DynamoDB write operation to an asynchronous invocation.
Why it's wrong here
Moving the DynamoDB write operation to an asynchronous invocation (e.g., via SQS or another Lambda) would defer the write, potentially reducing the overall execution duration of the *current* Lambda function if the write was synchronous and blocking. However, it does not free up memory *during* the image processing phase, which is where the "out-of-memory" error occurs. The memory exhaustion happens when the function attempts to load and manipulate the image data, independent of subsequent I/O operations.
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 |
Go deeper
Related to this question
About these practice questions
One of 724 original DVA-C02 practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. 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.