Update Lambda instructions for Node.js 4.3 (#419)

Amazon introduced Node.js 4.3 support for Lambda, which is now the
recommended runtime instead of the old Node.js 0.10. This commit revises
the Lambda docs to build Node.js 4.3 compatible binaries using the
latest stable Node.js 4.x packages from Nodesource.
This commit is contained in:
Felix Bünemann 2016-04-27 20:39:30 +02:00 committed by Lovell Fuller
parent b6030c161b
commit dce3840537

View File

@ -134,12 +134,11 @@ do this on a system similar to the [Lambda Execution Environment](http://docs.aw
small t2.micro instance using the AMI ID listed in the previous link, ssh into it as ec2-user small t2.micro instance using the AMI ID listed in the previous link, ssh into it as ec2-user
and follow the instructions below. and follow the instructions below.
Install depencies: Install dependencies:
```sh ```sh
sudo yum-config-manager --enable epel curl -s https://rpm.nodesource.com/setup_4.x | sudo bash -
sudo yum install -y nodejs gcc-c++ sudo yum install -y gcc-c++ nodejs
curl -s https://www.npmjs.com/install.sh | sudo sh
``` ```
Copy your code and package.json to the instance using `scp` and create a deployment package: Copy your code and package.json to the instance using `scp` and create a deployment package:
@ -150,7 +149,7 @@ npm install
zip -ur9 ../sharp-lambda-example.zip index.js node_modules zip -ur9 ../sharp-lambda-example.zip index.js node_modules
``` ```
You can now download your deployment ZIP using `scp` and upload it to Lambda. You can now download your deployment ZIP using `scp` and upload it to Lambda. Be sure to set your Lambda runtime to Node.js 4.3.
**Performance Tip:** To get the best performance on Lambda choose the largest memory available because this also gives you the most cpu time (a 1536 MB function is 12x faster than a 128 MB function). **Performance Tip:** To get the best performance on Lambda choose the largest memory available because this also gives you the most cpu time (a 1536 MB function is 12x faster than a 128 MB function).