AWS Certified Developer – Associate (DVA-C02) — Question 210
A developer is creating an AWS Lambda function that will generate and export a file. The function requires 100 MB of temporary storage for temporary files while running. These files will not be needed after the function is complete.
How can the developer MOST efficiently handle the temporary files?
Answer options
- A. Store the files in Amazon Elastic Block Store (Amazon EBS) and delete the files at the end of the Lambda function.
- B. Copy the files to Amazon Elastic File System (Amazon EFS) and delete the files at the end of the Lambda function.
- C. Store the files in the /tmp directory and delete the files at the end of the Lambda function.
- D. Copy the files to an Amazon S3 bucket with a lifecycle policy to delete the files.
Correct answer: C
Explanation
The /tmp directory in AWS Lambda provides up to 512 MB of temporary storage that is fast and directly accessible during the function's execution, making it the most efficient option for handling temporary files. Other options, such as Amazon EBS or EFS, introduce unnecessary complexity and latency, while S3 incurs additional costs and delays for file transfers.