Skip to content

zdenham/next-static-aws-example

Repository files navigation

This is a static next.js site built using next-static-utils.

See the live demo here!

It demonstrates hosting a static site with dynamic routes and the app router.

Deployment Instructions for AWS S3 + Cloudfront

  1. clone repo
  2. pnpm install
  3. Generate fallback routes: pnpm next-static-utils generate cloudfront
  4. Build the application: pnpm build
  5. Set up your local aws credentials
  6. Create an S3 bucket your-bucket
  7. Upload the static site cd out && aws s3 sync . s3://your-bucket
  8. Ensure the bucket is public and has public read policy, instructions here
  9. Create a cloudfront distribution and connect it to the s3 bucket as the origin
  10. Ensure your cloudfront distribution has a root object (index.html).
  11. Create a cloudfront function and paste the generated cloudfrontFunc.js from the repo root
  12. Associate the cloudfront function with your distribution's origin behavior (under viewer request)

TODO: We will likely make a script to automate the above, via terraform or the AWS SDK 👀

If you run into problems, open an issue!

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published