This is a simple Node.js application that enables users to upload files directly to an AWS S3 bucket using pre-signed URLs.
- Node.js
- npm (Node Package Manager)
- An AWS account with access to S3
ngrok
(optional, for exposing your local server to the internet)
-
Clone the repository to your local machine.
-
Navigate to the repository directory in your terminal.
-
Install the necessary dependencies by running:
npm install
-
Create a
.env
file in the root of the project with the following contents, substituting your own AWS credentials and bucket name:AWS_ACCESS_KEY_ID=your_access_key AWS_SECRET_ACCESS_KEY=your_secret_access_key AWS_REGION=your_region S3_BUCKET_NAME=your_bucket_name
-
Start the server by running:
npm start
Your server will start on
http://localhost:5500
.
To make your local server accessible over the internet, use ngrok
:
-
If you haven't already, signup, download and install
ngrok
from the ngrok website. -
In a new terminal window, start
ngrok
on the same port as your Node.js application:npm run live
-
ngrok
will provide a public URL (e.g.,https://abc123.ngrok.io
) which you can use to access your server from anywhere.
Open a web browser and navigate to http://localhost:5500
or the URL provided by ngrok
to access the file upload interface.
Note: Always keep your .env
file secure. Do not commit it to public version control repositories as it contains sensitive AWS credentials.