AWS - Deploy Next.js Application to AWS S3
Create an S3 Bucket
Go to Services > S3
Click on Create bucket
Enter a unique name for the bucket (e.g.
my-next-app)Uncheck Block all public access
Check the acknowledgment
Click on Create bucket

Enable static website hosting
Click on the created bucket
Go to Properties > Static website hosting
Select Use this bucket to host a website
Enter index.html for Index document and Error document
Click Save

Enable public access to the bucket using a bucket policy.
Go to Permissions > Bucket Policy
Enter the following policy and click Save

Static HTML Export
Add
next exportto package.jsonRun
yarn buildRun
yarn export
Publish Next.js Application to S3 bucket
Invalidating files from CloudFront edge caches before it expires
Last updated
Was this helpful?