Next.js Discord

Discord Forum

How to Upload and Run NextJs App Router v14 build to AWS S3 ? If possible then how?

Unanswered
Havana posted this in #help-forum
Open in Discord
HavanaOP
Almost possible in NextJS App Router v13, But how to upload Next JS App Router v14 Build on AWS S3 Bucket ?

I built the build with the npm run build command, But how to upload Build in the AWS S3 Bucket, How its Work in Bucket ?

I haven't done the try but how to do it ?

6 Replies

Please read this documentation : https://docs.aws.amazon.com/sdk-for-javascript/v2/developer-guide/s3-example-creating-buckets.html I think you are asking how to upload an asset or multiple assets(files, images etc) to aws s3 bucket using nextjs 14. Yes you can do this easily by integrating aws javascript api s3.upload (uploadParams, function (err, data) {
if (err) {
console.log("Error", err);
} if (data) {
console.log("Upload Success", data.Location);
}
}); please read the above documentation.
are you deploying a static nextjs website to aws s3?or you want to upload images , files to s3? if you are deploying a static website to s3 , then edit package.json to "build": "next build && next export". and execute "npm run build" in terminal(root directory), this will create a out folder in your root directory and you need to upload that out folder to aws s3 manually from aws s3 dashboard.Remember that you need to enable the static webhosting from aws s3 dashboard before uploading out folder. Thanks.
Follow above instructions to upload a static website to aws s3.
HavanaOP
okay thank you