Native executables

Lambda is actually designed to run code in any language, as Lambda's sandbox is just a container. The trick is that we could use a Node.js program to execute any binary shipped with the ZIP file before uploading.

It is worth noting that when preparing our own binary for Lambda, it must be statically compiled or matched with the shared libraries provided by Amazon Linux (as the containers used on Lambda are all Amazon Linux-based). It is our responsibility to track the Amazon Linux version by ourselves.

A project such as LambCI (http://github.com/lambci/docker-lambda) can help to solve this problem. LambCI provides a local sandbox environment, as Docker containers, that mimics the AWS Lambda environment by installing the same software and libraries, file structure, and permissions. It also defines the same set of environment variables, and other behaviors. Also, the username and group are defined to match the Lambda, for example, sbx_user1051.

With this local environment, we are allowed to safely test our codes inside this Docker container and can be sure that it will be running fine on Lambda.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset