roeland
roeland

Reputation: 6336

Where host the backend when NextJS is hosted on Vercel?

I'm creating a website with NextJS and will deploy it with Vercel. NextJS has API routes that Vercel will deploy to AWS Lambda if I understand correctly.

As backend I will use mysql like here: https://vercel.com/guides/deploying-next-and-mysql-with-vercel

But what is the best place to host this?
Is AWS the fastest because AWS Lambda is used?
But what region should I use then?
Wat is the best way to make it fast in eu and us?

Upvotes: 0

Views: 3423

Answers (1)

roeland
roeland

Reputation: 6336

I tested the region with this code in a API:

export default (req, res) => {
  res.statusCode = 200;
  res.json({ region: process.env.AWS_REGION || "NOT SET" });
};

The result was us-west-1 for me. (I live in Europe)

I found information about this here:
https://vercel.com/knowledge/choosing-deployment-regions

This seems to be correct for a hobby account.
For Pro you can select a region, but only one.
You need enterprise for multiple region.

The best place to host mysql would be in the aws us-west-1 region but I decided to not use Vercel because I prefer a different solution.

This may be an alternative: https://github.com/serverless-nextjs/serverless-next.js

Upvotes: 2

Related Questions