If you are using and depending on the TimerCheck.io
service, please be aware that the entire code base will be swapped out
and replaced with new code before the end of May, 2017.

Ideally, consumers of the TimerCheck.io API will notice no changes,
but if you are concerned, you can test out the new implementation
using this temporary endpoint: https://new.timercheck.io/

For example:




This new endpoint uses the same timer database, so all timers can be
queried and set using either endpoint.

At some point before the end of May, the new code will be activated by
the standard https://timercheck.io endpoint.


When the TimerCheck.io service was built two years ago, the only
language supported by AWS Lambda was NodeJS 0.10. The API Gateway
service was console only, and quite painful to set up.

It is two years later, and Amazon is retiring NodeJS
0.10. AWS Lambda functions written with this language
version will stop working at the end of May (a 1 month extension from
the original April deadline).

Though AWS Lambda now supports NodeJS 6.10, I decided to completely
rewrite the code for TimerCheck.io in Python 3.6, for which support
was just announced.

I’ve also been wanting to try out chalice for a long time
now. Since TimerCheck.io uses API Gateway and AWS Lambda, this was the
perfect opportunity, especially since chalice now also supports Python

Though I ran into a few issues trying to get chalice stages and
environment variables to work, the project went far easier than the
initial implementation, and I am happy with the result.


The chalice software makes creating APIs with Python a pleasure.

These four lines of code are an example of how easy it is to define an
API with chalice. This is how the timer set API is defined.

from chalice import Chalice
app = Chalice(app_name='timercheck') @app.route('/{timer}/{count}')
def set_timer(timer, count): [...]

The biggest benefit is that chalice takes care of all of the API
Gateway hassles.

After a chalice deploy, all I had to do to make this production
worthy was:

  • Create an ACM certificate

  • Point an API Gateway custom domain at the chalice-created API
    Gateway stage, using the certificate.

  • Add the host record to DNS in Route 53 for the resulting API Gateway
    CloudFront distribution.

The entire new source for the TimerCheck.io service is available in
the timercheck repository on GitHub.

Original article and comments: https://alestic.com/2017/05/timercheck-aws-chalice/

Facebook Comments
Spread the love

Posted by News Monkey