Description
Use AWS S3 to upload images to a bucket from a Next.js application.
npx boilerapp aws-s3-image-upload-nextjs文档
Next.js + AWS S3 Upload
This is an example of a Next.js application allowing you to upload photos to an S3 bucket.
How to Use
Option 1: Use an existing S3 bucket.
Retrieve your existing access key, secret key, S3 bucket region and name. Provide those values after clicking "Deploy" to automatically set the environment variables.
Option 2: Create an S3 bucket.
Execute create-next-app with pnpm to bootstrap the example:
pnpm create next-app --example https://github.com/vercel/examples/tree/main/solutions/aws-s3-image-upload
- Create a new S3 Bucket.
- In Object Ownership, select "ACLs enabled" and "Bucket owner prefered"
- In Block Public Access settings for this bucket, uncheck "Block all public access".
- Create a new IAM User.
- Select "Attach policies directly".
- Add
s3:DeleteObject,s3:GetObject,s3:ListBucket,s3:PutObject,s3:PutObjectAcl
- Save the access key and secret key for the IAM User.
- Select the newly created user (IAM > Users > "your-user") and navigate to "Security Credentials".
- Under "Access Keys\
Prix
Gratuit