This project demonstrates a production-grade implementation of AWS S3 Files mounted as a file system on an EC2 instance using a VPC Interface Endpoint, enabling applications to interact with S3 using standard file operations.
Browser → Node.js App (EC2) → Mounted S3 Files (/mnt/s3files) → Amazon S3 Bucket
- ☁️ AWS EC2 (Ubuntu 24.04)
- 🪣 Amazon S3 (S3 Files - New Feature)
- 🌐 VPC Interface Endpoint (Private Connectivity)
- 🔐 Security Groups
- 🟢 Node.js (Express)
- 📂 File System Mount (s3files)
- Mount S3 as a local file system
- Read & write files using Node.js
- Private connectivity via VPC Endpoint (no public internet)
- Real-time sync between EC2 and S3
- REST API to interact with files
- Ubuntu 24.04
- Open ports:
22,3000
- Create a standard S3 bucket
- Attach to S3 bucket
- Type: Interface
- Service:
aws.api.<region>.s3files - Enable Private DNS
- Attach correct Security Group (IMPORTANT)
sudo mkdir /mnt/s3files
sudo mount -t s3files <file-system-id>:/ /mnt/s3filessudo chown -R ubuntu:ubuntu /mnt/s3filesnpm init -y
npm install expressconst express = require("express");
const fs = require("fs");
const app = express();
const PORT = 3000;
app.get("/", (req, res) => {
res.send("🚀 S3 Files System Working!");
});
app.get("/write", (req, res) => {
fs.writeFileSync("/mnt/s3files/hello.txt", "Hello from Node App");
res.send("File written to S3 Files!");
});
app.get("/read", (req, res) => {
const data = fs.readFileSync("/mnt/s3files/hello.txt", "utf-8");
res.send(data);
});
app.listen(PORT, "0.0.0.0", () => {
console.log(`Server running on port ${PORT}`);
});- VPC Interface Endpoints and PrivateLink
- DNS resolution inside VPC
- Security Group troubleshooting
- Mounting object storage as file system
- Integrating cloud storage with applications
- ❌ DNS resolution failure
- ❌ Mount timeout issues
- ❌ Permission denied on mount
- ❌ Security group misconfiguration
- Enabled VPC DNS settings
- Configured correct VPC Endpoint
- Updated Security Groups
- Fixed mount permissions
Implemented AWS S3 Files mounted on EC2 using VPC Interface Endpoint, enabling secure and scalable file operations through a Node.js application.
project/
│── app.js
│── package.json
│── package-lock.json
│── README.md
│── screenshots/
- Dockerize application
- Automate infra using Terraform
- Add Nginx reverse proxy
- Implement IAM role-based access
- AWS Blog: Launching S3 Files – Making S3 buckets accessible as file systems
- AWS Documentation: https://docs.aws.amazon.com/AmazonS3/latest/userguide/s3-files.html











