https://github.com/rootedglobal/node-phantomjs-aws-lambda
A PhantomJS node.js app for Amazon (AWS) Lambda
https://github.com/rootedglobal/node-phantomjs-aws-lambda
amazon-lambda aws node-lambda nodejs phantomjs phantomjs-lambda-template phantomjs-node
Last synced: 6 months ago
JSON representation
A PhantomJS node.js app for Amazon (AWS) Lambda
- Host: GitHub
- URL: https://github.com/rootedglobal/node-phantomjs-aws-lambda
- Owner: RootedGlobal
- Created: 2016-01-28T13:14:45.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2016-01-28T13:27:16.000Z (over 9 years ago)
- Last Synced: 2023-03-03T14:04:56.348Z (about 2 years ago)
- Topics: amazon-lambda, aws, node-lambda, nodejs, phantomjs, phantomjs-lambda-template, phantomjs-node
- Language: JavaScript
- Size: 29 MB
- Stars: 8
- Watchers: 2
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# PhantomJS Lambda Template
A [PhantomJS](http://phantomjs.org/) node.js app for [Amazon Lambda](http://aws.amazon.com/lambda/). Based on [node-lambda-template](https://github.com/rebelmail/node-lambda-template) using [node-lambda](https://github.com/rebelmail/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).
## Setup
Install dependencies using npm. It'll install the AWS SDK as well as PhantomJS on the development machine.
```shell
npm install
```## Usage
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](https://github.com/RebelMail/node-lambda).
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.
For this you need to have aws account and fill out confuguration in `.env` file:
AWS_ACCESS_KEY_ID=your_aws_key_id
AWS_SECRET_ACCESS_KEY=your_aws_secret_access_key
AWS_ROLE_ARN=your_amazon_role
AWS_REGION=us-east-1
....
```shell
npm run setup
```To run the function locally execute the following command.
```shell
npm run start
```Run the following command to deploy the app to Amazon Lambda.
```shell
npm run deploy
```> **Note:** npm version 2.x or newer required to pass arguments to the scripts using `-- args`
## Building phantomjs
If you want to use a different version of phantomjs or have trouble with the included version, follow the instructions in [build-phantomjs.sh](build-phantomjs.sh).