While Go is still not an officially supported language on Amazon Lambda, there are several ways to make it work:
- Lambda_proc - Node.js wrapper for your go binary
- GopherJS - Cross-Compile your Go code to NodeJS
- eawsy Lamba Go Shim - Python shim for your go binary
In my previous project where I built a screen scraper in Go and deployed it to Lambda, I utilized Lambda_proc. This does work pretty well an is a solid solution.
I found GopherJS to be an interesting project, but a pretty indirect way to get Go onto Lambda. Lambda can run Go Linux binaries, so converting your Go to JavaScript seems like the wrong approach.
The eawsy team released their new tool earlier this year and it seems to be the cleanest approach. The overhead between the Python shim and your Go code is clean and fast. They utilize a Docker container to build the necessary bridges from Python to Go, resulting in very fast execution. You can write log messages to the Lambda console using log.Printf. And it is FAST. The HelloWorld skill runs in sub-millisecond times!
To build Alexa skills in Go on Lambda, we still need an SDK. Amazon publishes SDKs for Java and JavaScript but not for Go. So I ported the Java SDK into Go as ericdaugherty/alexa-skills-kit-golang While this does not (yet) have the full depth of the Amazon SDK, it does enable you to build simple Alexa skills using Go and deploy them on Lambda.
Take a look at the alexa-skills-kit-golang project for usage and samples, and give the eawsy Lamba Go Shim a try for your next Go project on Amazon AWS Lambda.
- Updated 3/4/2017 - updated run time based on newer stable eawsy shim speeds.