id | title | sidebar_label |
---|---|---|
installation |
Installation |
Installation |
See the steps below to get started and install the Serverless Nextjs component in your NextJS project and then deploy
- Create a NextJS project:
npx create-next-app my-nextjs-app
- (Optional) Once it is created, you can run the app locally:
npm run dev
- (Optional) Open http://localhost:3000 with your browser to see the application
- Create a
serverless.yml
file at the root of your project and add your NextJS application as shown below:
# serverless.yml
myNextApplication:
component: "@sls-next/serverless-component@1.19.0" # or specify latest stable or alpha version found in https://www.npmjs.com/package/@sls-next/serverless-component
- It is recommended you pin the latest stable version of serverless-next.js component. Check out the versions here
- Create a
.env
file at the root of your project to spcify AWS credentials:
#.env
AWS_ACCESS_KEY_ID=accesskey
AWS_SECRET_ACCESS_KEY=accesskeysecret
- And simply deploy by running the command below from your project root:
$ serverless
If you get an error during the deployment process, checkout the FAQ.