GithubHelp home page GithubHelp logo

pedroorf1 / nextjs-s3-upload Goto Github PK

View Code? Open in Web Editor NEW

This project forked from tomfa/nextjs-s3-upload

0.0 0.0 0.0 214 KB

NextJS with file upload to AWS S3

Home Page: nextjs-s3-upload.vercel.app

Shell 0.75% JavaScript 2.16% TypeScript 86.60% CSS 2.88% HCL 7.61%

nextjs-s3-upload's Introduction

File uploading to AWS S3 buckets from a Next.js 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

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

yarn
yarn dev

Open 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 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

nextjs-s3-upload's People

Contributors

tomfa avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.