All Projects β†’ smithclay β†’ Lambdium

smithclay / Lambdium

Licence: isc
headless chrome + selenium webdriver in AWS Lambda using the serverless application model

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Lambdium

Serverless Chrome
🌐 Run headless Chrome/Chromium on AWS Lambda
Stars: ✭ 2,625 (+967.07%)
Mutual labels:  serverless, aws-lambda, lambda, chromium
Laravel Bridge
Package to use Laravel on AWS Lambda with Bref
Stars: ✭ 168 (-31.71%)
Mutual labels:  serverless, aws-lambda, lambda
Pychromeless
Python Lambda Chrome Automation (naming pending)
Stars: ✭ 219 (-10.98%)
Mutual labels:  aws-lambda, selenium, chromium
Serverlessish
Run the same Docker images in AWS Lambda and AWS ECS
Stars: ✭ 177 (-28.05%)
Mutual labels:  serverless, aws-lambda, lambda
Serverless Next.js
⚑ Deploy your Next.js apps on AWS Lambda@Edge via Serverless Components
Stars: ✭ 2,977 (+1110.16%)
Mutual labels:  serverless, aws-lambda, lambda
List Lambdas
Enumerate Lambda functions across all regions with useful metadata πŸ’‘πŸ’΅βš™
Stars: ✭ 156 (-36.59%)
Mutual labels:  serverless, aws-lambda, lambda
Es2017 Lambda Boilerplate
AWS Lambda boilerplate for Node.js 6.10, adding ES2018/7/6 features, Docker-based unit testing and various CI/CD configurations
Stars: ✭ 169 (-31.3%)
Mutual labels:  serverless, aws-lambda, lambda
Spark On Lambda
Apache Spark on AWS Lambda
Stars: ✭ 137 (-44.31%)
Mutual labels:  serverless, aws-lambda, lambda
Components
The Serverless Framework's new infrastructure provisioning technology β€” Build, compose, & deploy serverless apps in seconds...
Stars: ✭ 2,259 (+818.29%)
Mutual labels:  serverless, aws-lambda, lambda
Cdp4j
cdp4j - Chrome DevTools Protocol for Java
Stars: ✭ 232 (-5.69%)
Mutual labels:  selenium, selenium-webdriver, chromium
Bref
Serverless PHP on AWS Lambda
Stars: ✭ 2,382 (+868.29%)
Mutual labels:  serverless, aws-lambda, lambda
Serverless Sam
Serverless framework plugin to export AWS SAM templates for a service
Stars: ✭ 143 (-41.87%)
Mutual labels:  serverless, aws-lambda, lambda
Portkey
Live-coding the Cloud
Stars: ✭ 139 (-43.5%)
Mutual labels:  serverless, aws-lambda, lambda
Zappa
Serverless Python
Stars: ✭ 11,859 (+4720.73%)
Mutual labels:  serverless, aws-lambda, lambda
Flogo
Project Flogo is an open source ecosystem of opinionated event-driven capabilities to simplify building efficient & modern serverless functions, microservices & edge apps.
Stars: ✭ 1,891 (+668.7%)
Mutual labels:  serverless, aws-lambda, lambda
Aws Lambda Power Tuning
AWS Lambda Power Tuning is an open-source tool that can help you visualize and fine-tune the memory/power configuration of Lambda functions. It runs in your own AWS account - powered by AWS Step Functions - and it supports three optimization strategies: cost, speed, and balanced.
Stars: ✭ 3,040 (+1135.77%)
Mutual labels:  serverless, aws-lambda, lambda
Iopipe Js Core
Observe and develop serverless apps with confidence on AWS Lambda with Tracing, Metrics, Profiling, Monitoring, and more.
Stars: ✭ 123 (-50%)
Mutual labels:  serverless, aws-lambda, lambda
Aws Lambda List
A list of hopefully useful AWS lambdas and lambda-related resources.
Stars: ✭ 130 (-47.15%)
Mutual labels:  serverless, aws-lambda, lambda
Chrome Aws Lambda
Chromium Binary for AWS Lambda and Google Cloud Functions
Stars: ✭ 2,502 (+917.07%)
Mutual labels:  serverless, aws-lambda, chromium
Serverless Sinatra Sample
Demo code for running Ruby Sinatra on AWS Lambda
Stars: ✭ 195 (-20.73%)
Mutual labels:  serverless, aws-lambda, lambda

lambdium

headless chrome + selenium webdriver in AWS Lambda

Lambdium uses Selenium Webdriver with Headless Chromium to run Webdriver scripts written in JavaScript on AWS Lambda. Since this project was created, AWS now offers this as a completely managed service called Device Farm Desktop Browser Testing.

You can use this AWS Lambda function by itself, bundled with your own application as a standalone AWS Lambda layer, or with other AWS services to:

  • Run many concurrent selenium scripts at the same time without worrying about the infrastructure
  • Run execute a selenium script via an HTTP call using API Gateway (example app)
  • Configure Cloudwatch events to run a script on a schedule (example app)
  • Integrate selenium tests running in Chrome into different event-driven workflows (like CodeDeploy checks, webhooks, or uploads to an S3 bucket)

Since this Lambda function is written using node.js, you can run almost any script written for selenium-webdriver. Example scripts can be found in the examples directory.

This uses a special version of Chrome (headless chromium) from the serverless-chrome project.

This is highly experimental and not all chromedriver functions will work. Check issues for known issues.

Requirements and setup for local development

This project is on the AWS Serverless Application Repository, allowing you to install it in your AWS account with one click. Install in your AWS account here. Quickstart instructions are in the README-SAR.md file.

  • An AWS Account
  • The AWS SAM Local running functions locally with the Serverless Application Model (see: template.yaml, install: npm install -g aws-sam-local)
  • node.js + npm
  • modclean npm modules for reducing function size
  • Bash

Local development setup

1. Fetching large binary dependencies

The headless chromium binary is too large for Github, you need to fetch it using a script bundled in this repository. Marco LΓΌthy has an excellent post on Medium about how he built chromium for for AWS Lambda here.

    $ ./layer/fetch-binaries.sh
2. Building

This is now handled by the sam build command. In the root of this project, run:

    $ sam build
3. Running locally with SAM Local

SAM Local can run this function on your computer inside a Docker container that acts like AWS Lambda. To run the function with an example event trigger that uses selenium to use headless chromium to visit google.com, run this:

    $ sam local invoke Lambdium -e event.json

Deploying the function to AWS

To deploy the function to your AWS account, you'll need to have followed the instructions above to fetch dependencies. Running it locally with SAM local and the test event (in event.json) is a good idea to verify everything works correctly before running it in the cloud.

1. Creating a S3 bucket for the function deployment

This will create a file called packaged.yaml you can use with Cloudformation to deploy the function.

You need to create a S3 bucket configured on your AWS account to upload the packed function files. For example:

    $ export LAMBDA_BUCKET_NAME=lambdium-upload-bucket

2. Packaging the function for Cloudformation using SAM

    $ sam package --s3-bucket $LAMBDA_BUCKET_NAME > packaged.yaml

3. Deploying the package using SAM

This will create the function using Cloudformation after packaging it is complete.

    $ sam deploy --template-file ./packaged.yaml --stack-name <<your-cloudformation-stack-name>> --capabilities CAPABILITY_IAM

If set, the optional DEBUG_ENV environment variable will log additional information to Cloudwatch.

Running the function

Post-deploy, you can have AWS Lambda run a selenium script. There's an example of a selenium-webdriver simple script in the examples/ directory that the Lambda function can now run.

Expected JSON input for the function event trigger is: {"Base64Script": "<Base64 Encoding of Selenium Script>"} (this can also be provided as an environment variable named BASE64_SCRIPT).

To run the example Selenium script, you can use the example with the AWS CLI in the scripts directory. It takes care of base64 encoding the file and assumes the function name is lambdium running in us-west-2:

    $ scripts/invoke.sh

To use your own selenium-webdriver script:

    $ scripts/invoke.sh ~/Desktop/my-script.js

Related projects

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].