9

I am looking for some advices, I am using Next.js to serve static pages that can be updated frequently, my app uses all kind of rendering : SSG, SSR and iSSG (new Incremental Static Site Generation feature).

Exemple of AWS architecture I thought:

  • EC2 to deploy a node.js server running next.js app
  • (if it is possible) Store/update static pages generated by Next.js SSR/iSSG in a S3 bucket
  • Cloudfront to cache pages (using either EC2 or S3 bucket if it is possible)

Do you know what is the best AWS architecture I could use according to my needs?

Edit: Maybe AWS Elastic Beanstalk is the solution, I am taking a look.

3
  • Did you found anything? I am thinking to use ECS fargate with EFS to store the build directory at common location. Commented Sep 5, 2020 at 8:54
  • you can use serverless nextjs github.com/serverless-nextjs/serverless-next.js It deploys on CloudFront and creates lambda function and uses s3 for storage Commented Sep 20, 2020 at 18:00
  • You can look into AWS Amplify. It may require additional code modification but this can result in easier deployments. Commented Aug 30, 2021 at 19:00

1 Answer 1

2

Next.js 11 + SST + Lambda@Edge

Serverless deployment was introduced in Next.js 8. This makes it easier for you to deploy your Next.js app to AWS Lambda functions, and take advantage of the serverless architecture. It's often much cheaper to host this way, and faster because you are serving the pages behind a CloudFront CDN network.

The SST framework makes it easy to help build and deploy your Next.js app to your AWS account using a combination of S3, Lambda@Edge and CloudFront. It also helps you configure a custom domain for the endpoint.

Here's an example walking through the setup - https://serverless-stack.com/examples/how-to-create-a-nextjs-app-with-serverless.html

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.