How to Fix Lambda Timeout for Large Image Processing
A company is building a new serverless application using AWS Lambda functions. The application processes images uploaded to an Amazon S3 bucket. Each image triggers a Lambda function that resizes the image and stores the result in another S3 bucket. The company expects a high volume of uploads, up to 10,000 images per minute. The current Lambda function is configured with a timeout of 5 minutes and 1024 MB of memory. During testing, the Lambda function times out for large images. What should the company do to ensure the function can process large images without timing out?
Quick Answer
The answer is to increase the Lambda function memory to 3008 MB, which directly resolves the Lambda timeout for large image processing by providing more CPU and network throughput. This works because AWS Lambda allocates CPU power and network bandwidth proportionally to the configured memory, so boosting memory accelerates the image resizing task, preventing it from hitting the 5-minute timeout. On the AWS Certified Solutions Architect Professional SAP-C02 exam, this tests your understanding of Lambda’s resource allocation model and the common trap of assuming that increasing the timeout alone will fix a CPU-bound task—when in fact the maximum timeout is 15 minutes and won’t help if the function lacks processing power. A key memory tip: “More memory means more muscle” for Lambda, as it directly correlates with faster execution and reduced timeout risk.
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 Lambda function memory to 3008 MB to get more CPU and network throughput.
Increasing Lambda memory proportionally increases CPU and network throughput, which can significantly speed up image processing, especially for large images, thereby reducing the likelihood of timeout. Option A: Increasing timeout does not address the root cause of slow processing; it only allows the function to run longer, but the function may still time out if processing is too slow. Option B: Using SQS decouples invocation but does not speed up individual function execution; it mainly helps with throttling and retries. Option C: Migrating to ECS on Fargate is not necessary; Lambda can handle this workload with sufficient memory allocation.
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 Lambda function timeout to 15 minutes.
Why it's wrong here
Increasing timeout does not address performance; large images may still take too long.
- ✗
Use Amazon SQS to decouple the S3 event and Lambda invocation, allowing Lambda to pull messages in batches.
Why it's wrong here
Batching does not help with individual large image processing time.
- ✗
Migrate the image processing to Amazon ECS on Fargate with a long-running task.
Why it's wrong here
Overly complex; Lambda can handle it with proper tuning.
- ✓
Increase the Lambda function memory to 3008 MB to get more CPU and network throughput.
Why this is correct
More memory allocates more vCPU, speeding up image processing.
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 1,660 original SAP-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 →
Same concept, more angles
1 more way this is tested on SAP-C02
These questions test the same concept from different angles. Work through them to make sure you can recognise it however the exam phrases it.
Variation 1. A company is building a serverless application using AWS Lambda. The application processes files uploaded to an S3 bucket. Each file can be up to 500 MB, and processing takes up to 10 minutes. The Lambda function must be triggered as soon as a file is uploaded. Which configuration should they use?
medium- A.Use S3 event notification to send an SQS message, which triggers Lambda.
- ✓ B.Configure S3 event notification to invoke the Lambda function directly.
- C.Increase the Lambda function timeout to 15 minutes and memory to 3 GB.
- D.Use AWS Step Functions to poll S3 and invoke Lambda.
Why B: S3 event notifications can directly invoke a Lambda function when an object is created, which meets the requirement of triggering the function as soon as a file is uploaded. Lambda supports a maximum timeout of 15 minutes and up to 10 GB of memory, so the 10-minute processing time and 500 MB file size are within limits. Option A is incorrect because using SQS between S3 and Lambda adds unnecessary complexity and latency, and is not needed when the direct trigger works. Option C is incorrect because increasing timeout and memory addresses resource limits but does not affect triggering; moreover, the default timeout can be set to 10 minutes without issue. Option D is incorrect because Step Functions add unnecessary orchestration complexity when a simple event trigger suffices.
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This SAP-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 SAP-C02 exam.