https://github.com/briso10-dev/nodejs-buckets3
Uploading an object into a bucket S3 using AWS SDK for nodejs
https://github.com/briso10-dev/nodejs-buckets3
aws javascript nodejs s3-bucket
Last synced: 5 months ago
JSON representation
Uploading an object into a bucket S3 using AWS SDK for nodejs
- Host: GitHub
- URL: https://github.com/briso10-dev/nodejs-buckets3
- Owner: Briso10-dev
- Created: 2024-08-09T04:23:59.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2025-03-19T22:11:59.000Z (over 1 year ago)
- Last Synced: 2025-07-20T07:40:01.707Z (12 months ago)
- Topics: aws, javascript, nodejs, s3-bucket
- Language: JavaScript
- Homepage:
- Size: 1.43 MB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# AWS S3 Bucket File Manager
A Node.js application demonstrating AWS S3 bucket operations using the AWS SDK for JavaScript v3. This project showcases basic S3 operations like uploading files and listing bucket contents.
## Features
- Upload files to S3 bucket
- List objects in S3 bucket
- Environment-based configuration
- Docker support for containerized deployment
## Tech Stack
| Technology | Version | Purpose |
|------------|---------|----------|
| Node.js | 20.x | Runtime environment |
| AWS SDK | ^3.627.0| S3 bucket operations |
| Docker | - | Containerization |
| dotenv | ^16.4.5 | Environment management |
## Prerequisites
- Node.js 20.x or higher
- AWS account with S3 access
- S3 bucket created
- AWS credentials (Access Key and Secret Key)
## Installation
1. Clone the repository
```bash
git clone https://github.com/Briso10-dev/nodeJS-bucketS3.git
cd nodeJS-bucketS3
```
2. Install dependencies
```bash
npm install
```
3. Configure environment variables
```bash
cp .env.example .env
# Edit .env with your AWS credentials
```
## Configuration
Create a `.env` file with the following variables:
```env
END_POINT=your_endpoint_url
REGION=your_region
ACCESS_KEY=your_access_key
SECRET_KEY=your_secret_key
```
## Usage
### Running Locally
```bash
node app.mjs
```
### Using Docker
1. Build the image
```bash
docker build -t s3-bucket-app .
```
2. Run the container
```bash
docker run --env-file .env s3-bucket-app
```
## Code Examples
### Uploading a File
```javascript
await uploadFile(
"your-bucket-name",
"test-file.txt",
"Hello World!"
);
```
### Listing Bucket Contents
```javascript
await listObjects("your-bucket-name");
```
## Security
- Environment variables for sensitive data
- Docker non-root user implementation
- .gitignore configured for sensitive files
## Author
- [@Briso10-dev](https://github.com/Briso10-dev)
## License
This project is licensed under the ISC License - see the [package.json](package.json) file for details.
## Contributing
Feel free to contribute to this project. Any contributions you make are greatly appreciated.
1. Fork the Project
2. Create your Feature Branch (`git checkout -b feature/AmazingFeature`)
3. Commit your Changes (`git commit -m 'Add some AmazingFeature'`)
4. Push to the Branch (`git push origin feature/AmazingFeature`)
5. Open a Pull Request