You can deploy static apps/website on AWS using S3 or Amplify. I prefer AWS Amplify and in this tutorial, I am going to quickly show you how you can deploy your Next.js app on AWS Amplify within 5 minutes with CI/CD.
I assume you already have next.js app ready, if not please clone this sample app.
Select GitHub and then click "Continue" - it will ask you to authorize Github, if you need help please read step 1 of my previous article
The final build settings should look like this: 👇🏽
version: 1 frontend: phases: preBuild: commands: - yarn install build: commands: - yarn run export artifacts: baseDirectory: out files: - '**/*' cache: paths: - node_modules/**/*
To test whether CI/CD (technically only CD) is working, make changes to your app and push them to your repo. They should be live after all the stages have passed.
- If you are not using
yarn, please change the build settings accordingly (with
- We are using Next.js static export
- You can use the same procedure for hosting any front-end/static app (React, Vue, Angular, etc.) - even you can deploy Nuxt.js app
- If you don't want to use
static exportsand need SSR then read this