Q47 — AWS DVA-C02 Ch.3

Question 47 of 100 | ← Chapter 3

A developer is creating an AWS Lambda function that generates and exports a file. During execution, the function requires 100 MB of temporary storage to stage the file. These files are no longer needed after the function completes. How can the developer most efficiently handle these temporary files?

Correct Answer: C. Store the files in the /tmp directory and delete them at the end of the Lambda function.

Explanation

Lambda provides 512 MB of ephemeral local disk space mounted at /tmp, optimized for temporary file staging. Data in /tmp is automatically deleted after invocation completion, making explicit cleanup optional and eliminating persistent storage costs or management overhead. Options A and B involve external, persistent storage (EBS/EFS), which is overkill, costly, and introduces latency and configuration complexity. Option D uses S3 — appropriate for durable storage but unnecessarily expensive and slower for transient data. Thus, /tmp (Option C) is the most efficient and idiomatic approach.