Untitled Lesson
Skill Matrix
UNLOCK NODES BY LEARNING NEW TAGS.
Why is saving uploaded files directly to a container's local disk generally problematic for a production Node.js application running multiple replicas?
💻 Code Challenge | +75 XP
Implement a file upload endpoint using Multer's memoryStorage that streams the uploaded file directly to S3 using PutObjectCommand, with a structured key including the user ID and current year.
A file uploaded successfully to a running container instance became inaccessible after the application was redeployed to new container instances. Reorder the steps to diagnose and fix the root cause.
Task: Reorder the blocks in logical sequence to solve the problem.
A.D.A. Interface
Adaptive Didactic Assistant

Pascual Vila
Frontend Instructor // Code Syllabus
The Error //
Saving uploaded files to a container or server's local file system in a production, horizontally-scaled deployment
// Wrong: lost on redeploy, invisible to other replicas
await fs.writeFile("/app/uploads/file.jpg", buffer);
// Correct: durable, accessible from every instance
await s3.send(new PutObjectCommand({ Bucket: "uploads", Key: "file.jpg", Body: buffer }));The Solution //
Local disk storage in most container-based deployments is ephemeral (files are lost when the container is replaced during a redeploy or restart) and isolated to that specific instance (invisible to any other replica handling a different request). Use a durable, external object storage service instead, accessible consistently from any instance.
The Error //
Making an entire object storage bucket publicly accessible and relying on unguessable object keys as the only access control
// Risky: not real access control, just obscurity
// (entire bucket set to public-read)
// Correct: private bucket, selective, time-limited access granted
const downloadUrl = await getSignedUrl(s3, getObjectCommand, { expiresIn: 300 });The Solution //
A "public" bucket means anyone with (or able to guess, enumerate, or otherwise obtain) an object's key can access it directly — this is not genuine access control. Keep buckets private by default and grant access selectively through presigned URLs or proper IAM-based permissions.