In recent months I’ve been taking a closer look at how data transfer works between the browser, the server, and the database, and have built a prototype application using Next.js and deployed it to Vercel to help visualize and calculate the distances that data has to travel between them. You can preview the app and see the code on GitHub using the links below.
A Serverless Function or Lambda Function can’t be deployed globally around a CDN; and instead, will be deployed to a region. Vercel is built on AWS and Vercel Serverless Functions can only be deployed to a https://vercel.com/docs/concepts/edge-network/regions#routing of the available https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/Concepts.RegionsAndAvailabilityZones.html.
For my purposes, I didn’t want to upgrade to a Vercel Enterprise plan, so instead I built a https://aws.amazon.com/route53/ API Gateway using AWS and then deployed multiple Lambda Functions to match the regions of the CockroachDB multiregion serverless databases, which are free and come with a https://www.cockroachlabs.com/pricing/.