Question #1099
A media company is developing an image processing application that transforms high-resolution image files. After processing, the files are archived. The company stores the files in an Amazon S3 bucket, with each file averaging 1.5 GB in size and none exceeding 2 GB. An AWS Lambda function is triggered once per file, and the transformation process is compute-intensive, requiring the application to read each file multiple times. Which solution will optimize performance MOST effectively?
Attach an Amazon Elastic Block Store (Amazon EBS) volume larger than 2 GB to the Lambda function. Copy the files from the S3 bucket to the EBS volume.
Configure the Lambda function code to read the image files directly from the S3 bucket during processing.
Increase the ephemeral storage size to 2 GB and copy the files from the S3 bucket to the Lambda function's /tmp directory.
Attach an Elastic Fabric Adapter (EFA) to the Lambda function to accelerate network access to the S3 bucket.
Explanation
Option C is correct because:
- Lambda's /tmp directory (ephemeral storage) can be increased up to 10 GB, which accommodates the 2 GB file size.
- Copying the file once from S3 to /tmp avoids repeated network transfers, reducing latency and S3 API costs.
- Local disk access is faster than repeated S3 GET requests, critical for compute-heavy tasks.
Other options are incorrect because:
- A: Lambda does not support EBS volumes; only /tmp is available for temporary storage.
- B: Reading directly from S3 multiple times introduces network latency and slower processing.
- D: Lambda does not support Elastic Fabric Adapters (EFAs), which are EC2-specific for HPC workloads.
Key Points:
- Use Lambda's ephemeral storage (/tmp) for temporary large file storage.
- Avoid repeated S3 reads by caching locally when processing requires multiple accesses.
- Lambda's ephemeral storage is configurable up to 10 GB (since 2022).
Answer
The correct answer is: C