Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/faisalamin001/upgallery
https://github.com/faisalamin001/upgallery
Last synced: 1 day ago
JSON representation
- Host: GitHub
- URL: https://github.com/faisalamin001/upgallery
- Owner: faisalamin001
- Created: 2024-06-05T11:46:08.000Z (5 months ago)
- Default Branch: main
- Last Pushed: 2024-06-21T11:08:54.000Z (5 months ago)
- Last Synced: 2024-06-23T04:06:30.184Z (5 months ago)
- Language: TypeScript
- Homepage: https://upgallery.vercel.app
- Size: 359 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# File uploading to AWS S3 buckets from a [Next.js](https://nextjs.org/) project.
This repo shows file upload, list, display and delete of private files in S3, from Next.js.
_Demo: [https://nextjs-s3-upload.vercel.app](https://nextjs-s3-upload.vercel.app)_
## Setup
_You'll need an S3 bucket and AWS credentials to run the
app. See section at bottom if you haven't got this already_.### Set up env
Copy .env.example files to .env.local
```
cp .env.example .env.local
```Replace with your aws region, bucket name and keys
```
S3_BUCKET_REGION=eu-north-1
S3_BUCKET_NAME=my.bucket.name
SECRET_AWS_ACCESS_KEY_ID=AKIAMyAWSAccessId......
SECRET_AWS_SECRET_ACCESS_KEY=XMyAWSSecret.......
```### Install and run
```bash
yarn
yarn dev
```Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
## Add S3 bucket and IAM user
You'll need an S3 bucket and AWS credentials to run the
app.#### Manually
- Navigate to [AWS console](https://s3.console.aws.amazon.com/) and create a regular S3 bucket.
- Preferably, create a new IAM user and download its keys.#### With terraform
Terraform files are added to the **infrastructure** folder. This will prompt for bucket name, and then create a bucket and an IAM user with necessary permissions.
```
# Install terraform
brew install hashicorp/tap/terraform# Navigate to terraform files
cd infrastructure# Download modules
terraform init# Create stuff. Will prompt for info and confirmation
terraform apply
```