Using AWS Lambda to verify site uptime

  • node.js (which I passionately hate);
  • Java (boring: I’d need to package a jar);
  • Python (which I chose not to learn);
  • no native Go support as of now (although at some point in time maybe Amazon reacts to this forum post requesting exactly that). Yes I can “package my Go binary“ but that seems a bit non-native way of doing it.

Lambda code

  1. goes through the list of sites, verifies response is as expected
  2. expects all sites to be https (this might not be suitable your case — you might want to use require(‘http’) in place of https below)
  3. sends an email if at least one failure is detected

Trigger

Role

{
"Statement": [
{
"Action": [
"logs:CreateLogGroup",
"logs:CreateLogStream",
"logs:PutLogEvents"
],
"Effect": "Allow",
"Resource": "arn:aws:logs:*:*:*"
},
{
"Action": [
"ses:SendEmail"
],
"Effect": "Allow",
"Resource": "arn:aws:ses:us-east-1:<accountid>:identity/alarmemail@gmail.com"
}
],
"Version": "2012-10-17"
}

Billing

Profit and have fun

--

--

--

All-around software engineer born in Serbia, living in Belgium. Likes fantasy novels, weekend hacking and can't live without coffee.

Love podcasts or audiobooks? Learn on the go with our new app.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Milan Aleksić

Milan Aleksić

All-around software engineer born in Serbia, living in Belgium. Likes fantasy novels, weekend hacking and can't live without coffee.

More from Medium

Importing existing AWS resources using AWS CDK

5 Serverless use cases on AWS

Simple server-less public API’s with AWS API Gateway, Lambda and DynamoDB

Complete CRUD Application with AWS Serverless