This is a reference implementation of running PhantomJS on AWS Lambda deployed with AWS CodePipeline.
PhantomJS needs to be compiled for the OS you plan on running it and this can be painful because of that fact. This could be circumvented with a build server, which is a very personal decision and it was hard to commit to a build server for this little project. Now with AWS CodeBuild, this has become a trivial matter. So we are using AWS Developer tools 100%, AWS created a great walk through: Automating Deployment of Lambda-based Applications I have done my best to automate the walk through, so its simple and repeatable.
- Setup your AWS account and AWS CLI
- Fork this project
- Setup a personal access token with GitHub for AWS CodePipeline , you can skip this if you use AWS CodeCommit but you will have to change the cloudformation. https://github.com/settings/tokens
$ npm install
$ npm test
npm run deploy-pipeline -- --parameter-overrides \
EnvironmentName=phantom \
GitHubToken=< your token > \
GitHubUser=justengland \
Repo=phantom-lambda-template \
Branch=master
# **Note:** npm version 2.x or newer required to pass arguments to the scripts using `-- args`
- Checkout AWS CloudFormation
- Watch as AWS CodePipeline creates a new stack
- Once the stacks are finished test your AWS Lambda