Deploying a Next app to AWS with the AWS Amplify CLI

nader dabit
Instructornader dabit
Share this video with your friends

Social Share Links

Send Tweet

Learn how to deploy a Next app to Amplify Hosting using the Amplify CLI.

Nader Dabit: [0:01] To get started, create a new Next app by running npm init next-app. Here we'll give a project a name and choose the default starter app.

[0:10] Next, we'll change into the new directory and open the project in our text editor. What we'd like to do is add the next export command into our build script. Next export allows you to export your app to static HTML which can then be run standalone without the need of a Node.js server.

[0:26] Save this file and go back to the command line. Here we'll initialize a new amplify project by running amplify init. When prompted, give the project a name, the environment a name. Choose your default text editor and choose default for the rest of the options except for the Distribution Directory Path.

[0:44] For the Distribution Directory Path, set it to out because this is where the build step will be creating the static version of our site. When prompted for your AWS profile, chose the profile that you'd like to use.

[1:04] Next, we'll add hosting by running amplify add hosting. Here we'll choose Hosting with the Amplify Console and manual deployment.

[1:14] To publish this site, we can run amplify publish. When the deployment is complete, we should be given the deployment URL for our app.

[1:31] To view our app in the Amplify Console anytime, we can run amplify console.