I HATE on-call. That's why when I decided to start doing my own  side-hustle, I wanted to make sure there were no 4 AM wake-ups unless  necessary. I have designed a very simple and cheap process for  monitoring websites that uses AWS services. The basic process we use is  as follows:

Monitoring Logic Flow

When the SNS Topic is alerted, you are sent a message via either SMS or Email (whichever you have configured).

Getting up and running

I’ve created a simple solution to enable this monitoring for each Hosted  Zone. We go into Route 53 and add the following comments to each of our  Hosted Zones:

e.g. on;www;24x7
  • ON_OR_OFF: lowercase “on” or “off”. If set to “on”, the script will monitor your website.
  • SUBDOMAIN: the subdomain to monitor. E.g. if my subdomain is www and my Hosted Zone is engi.fyi, then it will check the URL https://www.engi.fyi/.
  • AVAILABILITY_HOURS: Not yet implemented.

Installing monitoring system

  1. Install Terraform.
  2. Run the following commands:
git clone https://github.com/HammoTime/aws-www-monitoring.git
cd aws-www-monitoring/
terraform init
terraform apply

3.   Create a subscription in the SNS Topic that should have been created (default: web_monitoring).

That is it, you’re all done! You will receive an initial ALARM text but  within five minutes you should receive the OK text (unless of course  your site is down).

Example notifications

Use cases

In most circumstances for simple websites, I would use Route 53 Health Checks.  However, I designed this solution as a simple project that would enable  someone to fork and get started on some complex monitoring. There are  some websites that need to perform specific checks on APIs and this  Lambda-based solution provides the framework for that to occur.

If you have any questions or problems, Contact Me at my personal website.  Thanks for reading, and see you for our next article