Skip to main content

AWS DVA-C02 Drill: Lambda Temporary Storage - The /tmp Directory vs. Persistent Storage

Jeff Taakey
Author
Jeff Taakey
21+ Year Enterprise Architect | AWS SAA/SAP & Multi-Cloud Expert.

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 choosing between ephemeral local storage and persistent external storage for Lambda. In production, this is about knowing exactly how Lambda’s execution environment manages /tmp storage within the invocation lifecycle. Let’s drill down.

The Certification Drill (Simulated Question)
#

Scenario
#

An innovative fintech startup called “Moneta Solutions” is developing a serverless processing Lambda function. During each invocation, the function needs to create and modify temporary files up to 10 MB in size. These files are only needed transiently while the function runs and do not need to be retained after completion. The development team wants the most efficient and secure place to store these temporary files during invocation.

The Requirement:
#

Where is the most appropriate location for storing these temporary files given the constraints?

The Options
#

  • A) The /tmp directory inside the Lambda execution environment
  • B) Amazon Elastic File System (Amazon EFS)
  • C) Amazon Elastic Block Store (Amazon EBS)
  • D) Amazon Simple Storage Service (Amazon S3)

Google adsense
#

leave a comment:

Correct Answer
#

A) The /tmp directory inside the Lambda execution environment

Quick Insight: The Developer Imperative
#

Lambda functions provide a built-in ephemeral file system mounted at /tmp that offers up to 512 MB of writable space, accessible during each invocation lifecycle. This is ideal for temporary files needed only during invocation and is faster and simpler than external storage options.

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 A: The /tmp directory inside the Lambda execution environment

The Winning Logic
#

AWS Lambda provides an ephemeral file system mounted at /tmp with up to 512 MB of storage capacity. This space is writable and persists only during the lifecycle of the invocation environment, making it ideal for temporary files created and accessed multiple times during a single invocation.

  • Advantages include very low latency file access, no additional configuration or cost, and automatic cleanup across invocation environments.
  • The /tmp directory satisfies the exact requirement: files are temporary, <10MB, exist only during invocation, and require fast local access.

The Trap (Distractor Analysis)
#

  • Why not B - Amazon EFS?
    EFS provides persistent network file storage, ideal if files must persist across invocations or be shared across Lambda instances. However, its latency and cost are unjustified when files are short-lived and ephemeral. EFS setup also adds complexity and cold start overhead.

  • Why not C - Amazon EBS?
    EBS volumes cannot be attached to Lambda functions, only EC2 instances and certain containers. Also, this is a block storage service not natively integrated with Lambda.

  • Why not D - Amazon S3?
    S3 is object storage optimized for durability and persistence, not low-latency, multiple-write file operations within an invocation. Writing frequently changing temporary files to S3 would add latency and cost, and complicate cleanup logic.


The Technical Blueprint
#

# Example: Writing a temporary file to /tmp in a Node.js Lambda function

const fs = require('fs');
const path = '/tmp/tempFile.txt';

exports.handler = async (event) => {
    // Write a temporary file
    fs.writeFileSync(path, 'Temporary data during invocation');
    
    // Read or modify it multiple times here...
    
    return `File written to ${path}`;
};

The Comparative Analysis
#

Option API Complexity Performance Use Case
A) /tmp Directory Minimal (local file I/O) Very Low Latency (local ephemeral) Temporary files during Lambda invocation
B) Amazon EFS Moderate (mount, config) Higher latency (network file system) Persistent shared file storage across Lambdas
C) Amazon EBS Not applicable Not supported with Lambda Attached block storage for EC2/containers
D) Amazon S3 Moderate (SDK calls) Higher latency, eventual consistency Durable, persistent object storage

Real-World Application (Practitioner Insight)
#

Exam Rule
#

“For the exam, always pick /tmp for ephemeral, transient file storage inside Lambda when dealing with files under 512 MB that don’t require persistence.”

Real World
#

“In production, if your temp files exceed 512 MB or require sharing between invocations, consider EFS. For persistent archival or large objects, S3 is your go-to.”


(CTA) Stop Guessing, Start Mastering
#


Disclaimer

This is a study note based on simulated scenarios for the AWS DVA-C02 exam.

The DevPro Network: Mission and Founder

A 21-Year Tech Leadership Journey

Jeff Taakey has driven complex systems for over two decades, serving in pivotal roles as an Architect, Technical Director, and startup Co-founder/CTO.

He holds both an MBA degree and a Computer Science Master's degree from an English-speaking university in Hong Kong. His expertise is further backed by multiple international certifications including TOGAF, PMP, ITIL, and AWS SAA.

His experience spans diverse sectors and includes leading large, multidisciplinary teams (up to 86 people). He has also served as a Development Team Lead while cooperating with global teams spanning North America, Europe, and Asia-Pacific. He has spearheaded the design of an industry cloud platform. This work was often conducted within global Fortune 500 environments like IBM, Citi and Panasonic.

Following a recent Master’s degree from an English-speaking university in Hong Kong, he launched this platform to share advanced, practical technical knowledge with the global developer community.


About This Site: AWS.CertDevPro.com


AWS.CertDevPro.com focuses exclusively on mastering the Amazon Web Services ecosystem. We transform raw practice questions into strategic Decision Matrices. Led by Jeff Taakey (MBA & 21-year veteran of IBM/Citi), we provide the exclusive SAA and SAP Master Packs designed to move your cloud expertise from certification-ready to project-ready.