Skip to content

AWS S3 Upload Starter Kit in which you can Upload, Get and Delete Files

Notifications You must be signed in to change notification settings

Ajay01103/NextJS-14-S3-Upload

Repository files navigation

This is a Next.js project bootstrapped with create-next-app.

Getting Started

First, clone the repo https://github.com/Ajay01103/NextJS-14-S3-Upload

npm install

npm run dev
# or
yarn dev
# or
pnpm dev
# or
bun dev

AWS S3 Bucket Configuration

  • Configure Bucket Policy in the bucket Permissions
{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "PublicRead",
            "Effect": "Allow",
            "Principal": "*",
            "Action": [
                "s3:GetObject",
                "s3:DeleteObject"
            ],
            "Resource": "arn:aws:s3:::your-bucket/*"
        }
    ]
}
  • Configure CORS Policy in Bucket Permissions
[
    {
        "AllowedHeaders": [
            "*"
        ],
        "AllowedMethods": [
            "PUT",
            "GET",
            "DELETE"
        ],
        "AllowedOrigins": [
            "http://localhost:3000"
        ],
        "ExposeHeaders": [],
        "MaxAgeSeconds": 3000
    }
]
  • Keep the Block Public Access Disabled in very first stage of creating a s3 bucket

Deploy on Vercel

The easiest way to deploy your Next.js app is to use the Vercel Platform from the creators of Next.js.

Check out our Next.js deployment documentation for more details.

About

AWS S3 Upload Starter Kit in which you can Upload, Get and Delete Files

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published