DEV Community

Marcelo Magario
Marcelo Magario

Posted on

New project deployed on AWS! Wi-Fi Connectivity Notification!

So, as usually the project starts to solve a problem this one is not different either.

The problem

My family has a beach house, and very often we go there and once we arrive we find out that the internet is not working! so annoying! That is really bad because sometimes we have plenty of work to do and we can't do much. So frustrating going there and wasting the afternoon calling and waiting the technician resolution.

So I decided to solve it for good!
I was thinking: what if we could know if the internet is working (or not) before we arrive there? even better, what if we could be notified if the internet was down or restored? well, that's when it all started the idea.

The solution
I took my brother's really old Galaxy A5 (2016) falling apart lol. It was just sitting in a drawer, and turned it into a simple internet monitor. Every 6 hours, it sends a quick GET request to a /heartbeat endpoint I created on a Node.js backend. This cycle can be configurated on .env to better attend your needs.

The backend is deployed on an AWS EC2 instance and already running in production.

If that heartbeat stops coming, the backend notices and sends me an email using AWS SES. When the connection comes back, I get another email letting me know it's back online.

The Stack

Galaxy A5 (2016): Sends a simple GET request every 6 hours. To send the requests I'm using the Macrodroid.

AWS EC2 (Node.js): Stores the last ping timestamp and checks for missed heartbeats

AWS SES: Sends email alerts if the device goes silent or comes back

Here's what the archtecture looks like:

It’s deployed, running, and giving me peace of mind!

Have a look on the code...

Github REPO:
https://github.com/marcelomagario/wifi-check

Difficulties & Learnings:
AWS SES Region: I learned that email verification is region-specific. My EC2 was in Ohio (us-east-2), but my SES was in N. Virginia (us-east-1). I had to verify my email in the correct region to make it work.
Email Verification: SES requires all sender and (in sandbox mode) recipient emails to be verified. This step is easy to miss!
Spam Issues: Emails sent from SES using a Gmail address as the sender often end up in spam. Using a custom domain is the best way to improve deliverability (but I didn't do because I didn't want to pay! cheap bastard! heheh).
Cost: By using a t2.micro EC2 instance and SES Free Tier, I can run this project 24/7 at almost zero cost.

Top comments (0)