Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

Sorry, you do not have permission to ask a question, You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please type your username.

Please type your E-Mail.

Please choose an appropriate title for the post.

Please choose the appropriate section so your post can be easily searched.

Please choose suitable Keywords Ex: post, video.

Browse

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

Querify Question Shop: Explore Expert Solutions and Unique Q&A Merchandise

Querify Question Shop: Explore Expert Solutions and Unique Q&A Merchandise Logo Querify Question Shop: Explore Expert Solutions and Unique Q&A Merchandise Logo

Querify Question Shop: Explore Expert Solutions and Unique Q&A Merchandise Navigation

  • Home
  • About Us
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • About Us
  • Contact Us
Home/ Questions/Q 5711

Querify Question Shop: Explore Expert Solutions and Unique Q&A Merchandise Latest Questions

Author
  • 60k
Author
Asked: November 27, 20242024-11-27T11:49:09+00:00 2024-11-27T11:49:09+00:00

In 5 steps host your NextJS 14 app on AWS Amplify and Integrate custom domain

  • 60k

You are a front-end engineer or someone who has never experienced the deployment or cloud. Now, you want to deploy your NextJS application on cloud. If you are looking to deploy your NextJS app on cloud without getting into the deep dive in cloud then AWS has a wonderful service for web and mobile developers – AWS amplify.

Amplify is a service designed to assist web and mobile developers in creating and deploying end-to-end apps. Amplify takes care of a lot of heavy lifting in the cloud backend, allowing users to focus on ‘doing more without delving too much into cloud or AWS’. It has simplified complex resource provisioning, deployment, environment creation, etc.

Features of Amplify:

  1. Hosting dynamic web and mobile apps
  2. API creation and hosting
  3. Authentication management
  4. Deployment via GitHub, etc
  5. Metrics, logging, etc
  6. Environment variables
  7. Custom domain
  8. Send notifications

In this blog, we will see how we can host a NextJS app from GitHub to Amplify and map a custom domain too in just 5 steps.

If you want to watch a video of the blog check here

In this blog, I will take you step by step to show how you can host your NextJS app on AWS using Amplify service.

Make sure you have your NextJS code hosted on GitHub (private or public , both is fine).

  1. NextJS code hosted in a GitHub account (private or public repo , both will work)

  2. Working AWS account

  3. Domain name from any vendor

  4. Domain setup at Route53

We will connect our code hosted in GitHub to Amplify. Whenever we will do any change in our code, push to our repo, and merge the code the deployment will happen automatically.

Step 0: Prepare your GitHub

Push your NextJS code to your GitHub. The repo could be public, or private. Amplify support monorepo too.

Step 1: Log in to your AWS Account

You should have a working AWS account. Log in to your account and go to the AWS amplify services ( search on the AWS search bar). You can change the region from the right-top corner. Make sure you to take a note of the region you are going to host your app.

Step 2: Host Web App

Your landing page will look different from the screenshot below (so, ignore), but on the right side, you will see an orange button – ‘New App.’ Click on that and select ‘Host Web App‘.

Image description

Step 3: Connect your Github

We will be connecting GitHub and deploying our repo for this demo. But we do have a lot of different options to pick our existing code from BitBucket, GitLab etc.

Choose the GitHub option.

To connect your GitHub to AWS. If you are connecting GitHub and AWS Amplify for the first-time, you need to give permission from GitHub to allow AWS Amplify ( all you need to do is just follow the screen).

Once AWS has the permission of GitHub, now click the “Continue” button.

Image description

Select the repo and branch you want to deploy to Amplify, and click on “Continue” button

Step 4: Build Settings & role

Once repo and branch is selected, AWS needs more information to create the build , test and setup the environment. You will see a screen like below. Please be aware that the build settings could be different based on the framework or language we are using in our code. If you are on NextJS then it would be same like the screenshot shown below.

Image description

We don’t need to do any changes here but its good to understand the fields here:

App Name: This name will reflect on the Amplify’s dashboard

Build and Test settings: This is the config file consist of the dependencies, build environments, instructions for creation of build, and test environment, etc. We can download this YML script and keep it in our local code.

IAM roles: This to allow the Amplify to do cross service access.

Now, click on “review and deploy“.

Image description

Now, just wait for the deployment to happen. It will just take a few minutes. Once the deployment will be successful you will see a screen with the URL.

If any of the steps are unsuccessful, you will see a screen like this with red indicating the step that failed. To debug we need to access the logs to identify the issues and try to fix it.

Image description

Common Errors:

I have covered these in the video.Do check here

1. Machine selection

This is the error I got stuck too. For new NextJS version we need to change the build settings and select the image “AWS Linux 2023”.

You can go to build settings from the left hand side navigation, Click on Edit, and select the image

Image description

2. Deployment errors

Remember there could be deployment or build issues if your local dependencies versions are different from what is required at the AWS build image. Eg: NodeJS version might be require at AWS build could be different (greater) from what you are using at local environment

Step 5: Domain setup

To setup your domain with the hosted app, you need to setup Route53. In AWS, go to Route53 and update the domain records there. Check video here to see how to setup Route53

Now, back to AWS Amplify page , select your project you hosted previously. Once you are in the project from left navigation click on domain management, and select “Add Domain” .

If your Route53 is successfully configured then in the drop down you will see your domain. Select from drop down and click on “Configure Domain” and click on “Add domain”

Image description

You will get the CNAME and just copy and use them in your domain settings. Amplify will do following for you:

  • SSL Creation
  • SSL Configuration
  • SSL verification
  • Domain Activation

Image description

Now, wait for a few hours and your domain would be ready and you will be able to access your hosted project.

Say Hi to me on Twitter and LinkedIn

Happy Learning!!

awsfullstacknextjswebdev
  • 0 0 Answers
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

Sidebar

Ask A Question

Stats

  • Questions 4k
  • Answers 0
  • Best Answers 0
  • Users 1k
  • Popular
  • Answers
  • Author

    How to ensure that all the routes on my Symfony ...

    • 0 Answers
  • Author

    Insights into Forms in Flask

    • 0 Answers
  • Author

    Kick Start Your Next Project With Holo Theme

    • 0 Answers

Top Members

Samantha Carter

Samantha Carter

  • 0 Questions
  • 20 Points
Begginer
Ella Lewis

Ella Lewis

  • 0 Questions
  • 20 Points
Begginer
Isaac Anderson

Isaac Anderson

  • 0 Questions
  • 20 Points
Begginer

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help

Footer

Querify Question Shop: Explore Expert Solutions and Unique Q&A Merchandise

Querify Question Shop: Explore, ask, and connect. Join our vibrant Q&A community today!

About Us

  • About Us
  • Contact Us
  • All Users

Legal Stuff

  • Terms of Use
  • Privacy Policy
  • Cookie Policy

Help

  • Knowledge Base
  • Support

Follow

© 2022 Querify Question. All Rights Reserved

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.