Serverless and AWS Lambdas to quickly replace freemium-level Pingdom


As I'm sure you've noticed, this very website, the one you are currently reading, went down some time ago and was down for an unknown amount of time. Guessing a week? Maybe longer? Likely, you know, because you kept returning to this very important website to see if it was back up. I apologize for the emotional damage you undoubtedly underwent. And I promise to rectify this situation.

At code4lib 2019 I went to a pre-conference on the Serverless Framework. Thanks to Karen for the nice overview.

An opportunity to experiment with this stuff presented itself when I discovered that this site was down a couple of days ago. Where was my pingdom alert email to tell me of the problem? Did I miss it in my inbox? Nope. I logged into Pingdom and to my surprise discovered that the rug had been pulled on the freemium approach. Sad face.

But, as it turns out: happy face. I went ahead and used this as an opportunity to make a Lambda figuring that checking if a site is down is a fit for the Lambda use-case, i.e., short-running tasks that are scheduled or triggered by something. Even better, I found lambda-ping. Following the instructions there, and after re-activating my suspended AWS account (I had closed it 2 years ago!) I was able to get a simple site pinger replacement for Pingdom in less than an hour.

The only piece to do after following the instructions on the Readme doc from lambda-ping is to establish a CloudWatch rule/alert and SNS topic. I setup an alert to fire off an SNS notification to the newly created Topic with my email subscribed. The rule in CloudWatch is a little wonky because you can't say "Status doesn't equal 200" which is what I'd want, you can only do greater than or less than. I figure I only need greater than 200 because I'm mostly concerned about 50x. If the server is down completely, i.e., a connection refused, then the status won't even be a number, so not sure yet how to handle that.

I am sure there's a better way to do all this, but this certainly works and was a fun first step into Serverless and Lambdas.

Add new comment

Restricted HTML

  • Allowed HTML tags: <a href hreflang> <em> <strong> <cite> <blockquote cite> <code> <ul type> <ol start type> <li> <dl> <dt> <dd> <h2 id> <h3 id> <h4 id> <h5 id> <h6 id>
  • Lines and paragraphs break automatically.
  • Web page addresses and email addresses turn into links automatically.