A PhantomJS node.js app for Amazon Lambda. Based on node-lambda-template using node-lambda. The app includes a PhantomJS binary (phantomjs
) compiled for AWS Linux (https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-1.9.8-linux-x86_64.tar.bz2).
Install dependencies using npm. It'll install the AWS SDK as well as PhantomJS on the development machine.
npm install
After installing use the following npm
commands as described below. They're only wrapping the node-lambda
functionality to allow node-lambda
to be installed only locally. Additional params can be provided using -- args
. For a list of available options see the node-lambda
documentation.
Run the setup command to generate the environment file with the configuration used for the Amazon Lambda function. Edit the resulting .env.
file with your custom settings.
npm run setup
To run the function locally execute the following command.
npm run start
Run the following command to deploy the app to Amazon Lambda.
npm run deploy
Note: npm version 2.x or newer required to pass arguments to the scripts using
-- args
If you want to use a different version of phantomjs or have trouble with the included version, follow the instructions in build-phantomjs.sh.