Post Image

Is My Train Fucked?

If you’ve ever met me, you probably know that I really like trains, specifically the New York City Subway. I’m fascinated with the idea of moving 6+ million people around over 660 miles today. However, as with any public transit system, there are often reliability problems with the service.

When I’m standing on the platform for a while waiting for a train, my first question is always “is my train fucked?”

So I built a website -

IsMyTrainFucked (IMTF) is written in python and intended to be an AWS Lambda microservice. I used Apex for function uploading, version management, and testing.

The way it works is actually pretty simple:

  1. MTA information is regularly loaded into DynamoDB by the update_log function. A CloudWatch “scheduler” kicks this off every 15 minutes.
  2. The update_s3_site function is invoked as a DynamoDB INSERT trigger, and a new index.html file is written to the IMTF S3 bucket.

With this, I don’t have to pay for a server running 24/7, and the cost of running this app is nearly zero. It was also really fun to learn about building an application that is embedded entirely into the AWS ecosystem.

As always, the source code is on github - PRs welcome!

header photo credit: Jackie Barr