Use Golang with AWS Lambda and S3


In a previous article, the author built a Node.js lambda function running in a container. Running a container as a serverless application worked out great: it meant it was simple to test locally and that I could install and use OS-level dependencies in a serverless function. That is how he was able to run Lynx in his AWS Lambda and build TextMode.

AWS Lambda’s and containers with Golang

Both combined seemed like a good solution, but node.js I’m less sure about. I’m not a JavaScript developer, and I chose Node.js merely because of the existence of the Mozilla Readability library. However, since then, I’ve found it has been ported to Golang, and I hope that the Golang version will be faster and easier for me to understand.

So today’s mission is to port that Node.js code to Golang, running in a container. I’ll also be using OS dependencies in my container, and because TextMode is a very cacheable service, I’m going to use S3 to cache the results as well.

This article teaches how to build a Golang Lambda service in a container, hook it up to a REST API end-point, and push and pull data from S3.

Porting to Golang was a performance win.

It’s surprising to me how much faster the Golang version is. Lynx and the readability lib do the majority of the work. Perhaps the native readability lib is just a lot faster but I’m not sure without digging in further.