Zeit - Functions as a Service

No Credit Card Required for something like AWS Lambda

Let me introduce you to this amazing service called zeit.co AKA ZEIT NOW.

I currently use it with another free online service called MicroBadger, a service I use to trigger custom Dockerbuilds after a base image such as alpine has been updated. This allows all my personal projects to be on the latest base image potentially improving performance and security.

Microservice sends a POST request to a function hosted on ZEIT NOW, and that function runs a bunch of tasks. Invoking new builds of personal projects that depend on that image, grabbing changelists and sending all that information to Slack.

I won’t show you how to do that, but I’ll show you how to get started with a full CICD pipeline.


ZEIT NOW is self-described as a All-in-one: Static and JAMstack deployment, Serverless Functions, and Global CDN.

In this post, I will be focusing on the serverless functions aspect as it is the most unique offering I know of. Serverless functions are not new. AWS Lambda has been doing it for a few years now, but the utility of Zeit NOW for me is derived from the fact that I did not have to enter any credit card information to get started.

Let’s go over the main limits of the (Hobby) free-tier:

2020-01-01HobbyProEnterprise
Deployments (per day)1002000Custom
Serverless Functions per Deployment1224Custom
Serverless Functions per Month160640Custom
Serverless Function Duration (Seconds)1060900
Deployments created from CLI per week20002000Custom
Team members per Team-10Custom

But let’s also remember the fair-use policy:

Examples of Fair UseNever Fair Use
Jamstack sites and appsProxies and VPNs
FrontendsMedia hosting for hot-linking
SPAsScrapers
Functions that query DBs or APIsCrypto Mining
Blogs, e-commerce, marketingCPU-intensive APIs (e.g.: Machine Learning)

  1. Let’s get started, install the zeit/now-cli.

  2. Clone/Fork my repository containing the example codebase sgama/demo-zeit-now.

  3. Import this project through the ZEIT web portal.

  4. Login to the now cli:

$ now login
  1. Run and deploy with the CLI:
/demo-zeit-now$ now
Now CLI 18.0.0
? Set up and deploy “/mnt/c/Vcs/demo-zeit-now”? [Y/n] y
? Which scope do you want to deploy to? MyUser
? Link to existing project? [y/N] n
? What’s your project’s name? demo-zeit-now
? In which directory is your code located? ./
�🔗  Linked to myuser/demo-zeit-now (created .no
�🔍  Inspect: https://zeit.co/myuser/demo-zeit-now/abc12cdef [1s]
✅  Production: https://demo-zeit-now.now.sh [19s]
�📝  Deployed to production. Run `now --prod` to overwrite later (https://zeit.ink/1A).
�💡  To change the domain or build command, go to https://zeit.co/myuser/demo-zeit-now/settings
  1. Now you should see your deployment at https://zeit.co/dashboard

Dashboard

  1. Add the following to your repository’s secrets for CICD here: https://github.com/$YOUR_USER/$YOUR_REPO/settings/secrets
ORG_IDjq -r '.orgId' .now/project.json
PROJECT_IDjq -r '.projectId' .now/project.json
ZEIT_TOKENGet one from https://zeit.co/account/tokens
  1. Uncomment the contents of .github/workflows/main.yml

  2. Push your code and view the CICD pipeline run: https://github.com/$YOUR_USER/$YOUR_REPO/actions


Now you can visit the following URLS:

  • https:/$YOUR_REPO.now.sh/src/nodejs
  • https:/$YOUR_REPO.now.sh/src/python

I’ll let you figure the rest out now but in this repo, you will now have a fully integration continuous integration and continuous delivery system deploying functions for free.