Jeff’s Note #
Unlike generic exam dumps, ADH analyzes this scenario through the lens of a Real-World Lead Developer.
For DVA-C02 candidates, the confusion often lies in how to efficiently manage temporary storage inside Lambda without unnecessary overhead or delays. In production, this is about knowing exactly the size limits and performance characteristics of Lambda’s ephemeral storage versus integrating external storage services. Let’s drill down.
The Certification Drill (Simulated Question) #
Scenario #
A fintech startup, FinEdge Labs, is building a serverless application to process and generate monthly transaction reports for their clients. The application uses AWS Lambda functions to produce report files that require roughly 100 MB of temporary storage during execution. These temporary files exist only during the function invocation and are discarded once the function finishes. FinEdge Labs wants the most efficient and cost-effective way to handle this temporary file storage without introducing unnecessary latencies or operational complexity.
The Requirement: #
Determine the best way for the Lambda function to manage temporary files during execution, given the need for 100 MB of transient, fast-access storage that is discarded after execution.
The 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
/tmpdirectory 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.
Google adsense #
leave a comment:
Correct Answer #
C
Quick Insight: The Developer Imperative #
- AWS Lambda provides a built-in ephemeral file system mounted at
/tmpwith up to 512 MB capacity by default, perfect for temporary storage during function execution.- This approach has no additional network latency, no extra cost beyond your Lambda invocation, and ephemeral storage data is discarded automatically after execution.
- Using external services like EFS introduces network overhead and configuration complexity, while EBS cannot be directly attached to Lambda.
- S3 is persistent and not optimized for transient temporary files and introduces additional API calls and storage costs.
Content Locked: The Expert Analysis #
You’ve identified the answer. But do you know the implementation details that separate a Junior from a Senior?
The Expert’s Analysis #
Correct Answer #
Option C
The Winning Logic #
AWS Lambda functions provide a local ephemeral file system mounted at /tmp with a storage limit of up to 512 MB. This built-in directory is specifically designed to allow functions to store temporary data during execution without incurring network latency or external dependencies. Because the temporary files are only needed transiently, and do not need to persist between invocations, /tmp is the most efficient location to store these files.
- Writing directly to
/tmpavoids the overhead of mounting or calling external services. - The 100 MB size requirement fits well within the default
/tmp512 MB capacity. - Files stored in
/tmpare discarded after the Lambda invocation completes, so manual cleanup is good hygiene but not strictly required. - This approach minimizes latency and reduces operational complexity.
The Trap (Distractor Analysis): #
-
Why not A?
Amazon EBS volumes cannot be directly attached to Lambda functions. EBS is designed for EC2, making this option invalid. -
Why not B?
Using Amazon Elastic File System (EFS) can be done with Lambda but introduces network latency and additional setup complexity. It’s ideal for large or persistent shared storage, not ephemeral temporary files within a single invocation. -
Why not D?
Amazon S3 is an object store optimized for durable, persistent storage, not ephemeral temporary data. Writing to S3 would introduce API call overhead, cost, and storage persistence that contradicts the requirement for temporary storage deletion post-execution.
The Technical Blueprint #
# Inside your Lambda function (Node.js example), write a temp file to /tmp:
const fs = require('fs');
const path = '/tmp/report.csv';
fs.writeFileSync(path, 'transaction_id,amount\n123,100.00\n');
console.log('Temporary file created at:', path);
// Continue processing or exporting...
The Comparative Analysis #
| Option | API/Integration Complexity | Performance | Use Case Suitability |
|---|---|---|---|
| A | Invalid for Lambda | N/A | Not possible - EBS not attachable to Lambda |
| B | Requires EFS mount setup | Network I/O latency | Better for persistent/large shared files |
| C | Zero additional config needed | Fastest (local disk) | Ideal for ephemeral, small-medium files |
| D | Requires S3 API calls | Slower due to network and API calls | Best for durable storage, not ephemeral temp |
Real-World Application (Practitioner Insight) #
Exam Rule #
For the exam, always pick /tmp ephemeral storage when the question references transient files up to 512 MB inside Lambda.
Real World #
In production, EFS might be used when you need persistent or shared storage between invocations or for larger data needs, but /tmp is the first-choice lightweight option for temporary storage within a single invocation.
(CTA) Stop Guessing, Start Mastering #
Disclaimer
This is a study note based on simulated scenarios for the DVA-C02 exam.