Build a “Serverless” Ping Service + Status Page in 4 Steps with StdLib Scheduled Tasks

One of the most requested features at StdLib has been the ability to create remote scheduled tasks, or the equivalent of cron jobs, using our FaaS ecosystem. We’ve had customers looking to build status pages, ping-based alert systems, and more. We launched our scheduled tasks into beta a few weeks ago and after some tinkering and building on our own, we’re excited to share our own status page built on top of scheduled tasks.
If you’re not familiar with Standard Library, we’re a Function as a Service platform and library. We provide scalable microservices with easy command line management, version immutability, type checking, a registry for service discovery, and more — all without the need to provision or manage servers.
We are going to run through the creation of StdLib’s own Status Page. If you’d like to follow along you’ll need:
- 1x StdLib account
- 1x AWS account (for DynamoDB access)
- 1x Your favorite terminal emulator

Step 1: Create a StdLib workspace
If you don’t have a StdLib account already you can make one on our website, or from our command line tool. To download the CLI, we recommend having the latest stable version of Node.js and npm, installed from the Official Node.js Website. To install our command line tools run:
$ npm install lib.cli -g
Now you’ll want to create a workspace and signup:
$ mkdir stdlib
$ cd stdlib
$ lib init
Next, get the code for the Status Page list by running:
$ lib create -s @steve/statusPage
Step 2: Create a DynamoDB Table
Sign into AWS and head over to your console. Hit DynamoDB (under Database) and find Create Table. We are going to partition the DynamoDB table by endpoints, which can be API endpoints, static sites, or any other service we want to track. We also want to add a sort key called timestamp, of type Number. To learn more about how DynamoDB uses these keys, see their docs.

While you are in the AWS console, you’ll want to find your public and secret keys. You can find them on the Security Credentials page. You’ll want to make sure that the keys you use have permission to change the DynamoDB table. Also take note of the table name and the region you created the table in.
Step 3: Set Environment Variables
Open up env.json
in your favorite text editor and you’ll find nine fields. Four of them, AWS_PUBLIC_KEY
, AWS_SECRET_KEY
, AWS_REGION
and DYNAMO_TABLE_NAME
, are Amazon specific and explained above. AUTH_KEY
is a random string that acts as a password to prevent others from adding entries to your DynamoDB table without permission. You’ll use this as a parameter to the scheduled task that calls this service, so generate one now by running node helpers/genAuthKey
while in the status page directory. LATENCY_THRESHOLD
is the amount of time (in milliseconds) required for the status page to show as yellow rather than green. TITLE
simply sets the HTML title tag. LOGO_URL
Should point to an image to go on top of the page. MAIN_PAGE_URL
is a link back to the main page of your website (the user is redirected when they click on your logo.
Next, open __main__.js.
Toward the top you’ll see a variable called URLS
. Replace them with the endpoints you plan on tracking. After doing so, you can run $ lib up dev
to push your service to a mutable development environment for testing. In order to run a scheduled task, you need to push an immutable release version with $ lib release
.
Step 4: Create a Scheduled Task
You can create a scheduled task either from the command line, or from the StdLib dashboard. From the command line you can run:
$ lib tasks:create [username]/statusPage logEndpoints
This command generates a series of prompts. First you want to enter an array of urls that you want to keep track of. They should be the same as the urls you just put in __main__js
. Next, enter the auth key you created in the previous step and choose one of your StdLib auth tokens (you most likely only have one). Finally, set your service to check your endpoints every five minutes. That means twelve times an hour, starting at the beginning of the hour.

After the scheduled task collects some data, you can head over to [username].api.stdlib.com/statusPage
to view your own status page! If you’d like to use a custom domain name, check out this article. Of course, this status page is about as simple as it gets, so feel free to make some changes!
Thanks for reading! Building a status page is just one of the countless things you can do with StdLib. If you have a neat idea you’d like to share, reach out to me directly by e-mail: steven@stdlib.com, or follow us on Twitter, @StdLibHQ.
We look forward to hearing from you, and happy building!