A Lambda function will create temporary files totaling 100 MB while it runs; those files are not needed after the function completes. What is the most efficient way for the function to handle these temporary files?
Choose an answer
Tap an option to check your answer.
Correct answer: Store the temporary files in the Lambda execution environment’s /tmp directory and remove them when the function finishes..
Why this is the answer
The most efficient way to handle temporary files in AWS Lambda is to use the /tmp directory. Each Lambda execution environment provides 512 MB of ephemeral storage in /tmp, which is automatically cleared after the function invocation completes or the environment is recycled. This makes it ideal for temporary files that are not needed long-term, as it avoids additional storage costs and management overhead. Writing to an Amazon EBS volume or Amazon EFS file system would introduce unnecessary complexity, latency, and cost for temporary data. Uploading to an S3 bucket is also inefficient for temporary files, as it incurs storage and transfer costs and requires a lifecycle rule for deletion, which is overkill for data only needed during a single invocation.
Pass your exam — without the endless answer hunt
Get every verified question and explanation for this exam in one place, and save hours of prep. 1,000+ certifications · 20+ languages · free to start.
Pass your exam faster → No card needed