Runs recent versions of Node.js on AWS Lambda. Tested with Node.js v4.2.4.
AWS Lambda
is sweet but at the time of this writing, it still
runs on Node.js v0.10.36,
which is ancient. The docs
suggest
including your own node
binary in the package zip. This little app
demonstrates that concept.
- Make sure you have Node.js and Gulp installed.
- Clone this repository and
npm install
it. - Create a Lambda function. By default, this app uses
node-wrapper
in theeu-west-1
region; you can change that ingulpfile.babel.js
. - Run
gulp deploy
to deploy the function. - Run the Lambda function.
- View the logs.
-
Because zip files don't support permissions, you need to
chmod
thenode
binary at runtime. However, the file is read-only, so you need to copy it to/tmp
first. Obviously, this implies a performance hit. -
With the 512 MB Lambda configuration, copying
node
takes about 300 ms, and spawning the (trivial) child script adds another 300 ms. Even if your code isn't time-critical, this slowdown will still impact your AWS bill. -
Even without the latest Node, deploying a Lambda is a hassle due to the fact that you need to include the required
node_modules
manually. For the sake of simplicity, this app only relies onbabel-runtime
.
MIT