AMPLIFY // NETLIFY // VERCEL // DATASTAX
These serverless functions practically write themselves.
Step-by-step serverless setup using Amplify, Netlify, or Vercel, connecting to a free Apache Cassandra-as-a-Service database from DataStax.
As Swizec Teller warns in the Serverless Handbook, AWS can be a pain. My own frustrations with the AWS dashboard–as a user but especially as a developer advocate–led me away from using AWS Lambdas for the OCR function in my comic translation app, as I explained late last year:
Also true, though: even if your app does need a serverless function–and even if that serverless function was required to be an official AWS Lambda–you wouldn’t need the AWS dashboard, or an AWS account, to get it up and running. Two of the most popular Jamstack hosting platforms, Netlify and Vercel, offer idiot-proof wrappers for AWS Lambda deployments, each more developer-friendly than the next.
Meanwhile, AWS is hardly neglecting their own developer ergonomics. Their Amplify CLI goes far towards relieving many prior headaches, Cognito management in particular. Lambda set-up with Amplify, they rightly brag, takes only two commands.
All of which presents 2021’s front-end developer with a classic high-quality problem: three distinct but compelling APIs for “real AWS Lambda functions”–Amplify’s, Netlify’s, and Vercel’s–representing three competing visions of simplicity.
Having reached the point in my app’s development where I do need a Lambda–to chat with the Apache Cassandra database where I’ll be storing my translations–it seemed worthwhile to feature-compare my walkthroughs of the three APIs.
AMPLIFY vs. NETLIFY vs. VERCEL: WHICH IS THE EASIEST?
Putting the platforms through the same paces, I hoped, would reveal a clear favorite, or at least a clear loser–but they’re all three pretty great tools, from teams clearly focused on state-of-the-art DX. There’s some variety amongst documentation style, dev servers, and file structures, but given my previous struggles with Lambdas, far fewer gotchas than I’d expected.
Lined up next to one another, my crib-sheet above confirms my perception of Vercel having the fewest commands to remember. This is slightly deceptive, in that Next.js already bundles in a dev server (otherwise requiring vercel dev and vercel deploy steps.) More generally, I’d break down my most deciding factors for each platform as follows:
Long story short: since I’m already using Vercel’s Next.js framework for my app–and Next.js gives you a free serverless API out of the box–I intend to use Vercel, but it’s a close call. (And by no means final: I started my OCR project with Python Lambdas on the AWS Dashboard and I’m certain to try other languages and APIs before I’m done.)
The linked repo collects step-by-step deployment instructions for all three platforms. Where the steps occur on a web dashboard or a CLI, I’ve included screencast GIFs to illustrate the interaction.
Taken individually, none of these steps seem too challenging to remember, but I’m always amazed how quickly the details slip away. Stack Overflow fixes and key doc pages especially–which I either bookmark and forget or keep open as Chrome tabs for decades.
Getting those out of my bookmarks and into a repo feels good, but if I can help someone get a serverless function running in a day instead of a week, I’ll feel even better, so please let me know!
UP NEXT: A deployed translation app to test and clone.