Coder Social home page Coder Social logo

lari / playwright-aws-lambda-example Goto Github PK

View Code? Open in Web Editor NEW
22.0 1.0 6.0 9 KB

An example project for running Playwright on AWS Lambda using the newly released features of using custom container images as Lambda functions.

License: MIT License

Dockerfile 50.42% Shell 4.88% JavaScript 44.70%

playwright-aws-lambda-example's Introduction

Playwright on AWS Lambda

This is an example project for running Playwright on AWS Lambda using the newly released features of running custom container images as Lambda functions.

I also wrote a post about Playwright on AWS Lambda to my Hashbode blog.

NOTE! Currently only Chromium and WebKit browser are working. Firefox requires some more tuning...

How to use this

Requirements

Locally with Docker

Build docker container image

docker build -t playwright-aws-lambda-example:latest .

Run container

docker run -p 9000:8080 playwright-aws-lambda-example:latest

Invoke function

curl -XPOST "http://localhost:9000/2015-03-31/functions/function/invocations" -d '{}'

Deploying to AWS Lambda

In the following examples, replace YOUR_AWS_ACCOUNT_ID with your AWS Account Id.

Create repository on AWS ECR (Elastic Container Registry)

aws ecr create-repository --repository-name playwright-aws-lambda-example --image-scanning-configuration scanOnPush=true

Tag docker image for ECR repository

docker tag playwright-aws-lambda-example:latest YOUR_AWS_ACCOUNT_ID.dkr.ecr.eu-west-1.amazonaws.com/playwright-aws-lambda-example:latest

Login

aws ecr get-login-password | docker login --username AWS --password-stdin YOUR_AWS_ACCOUNT_ID.dkr.ecr.eu-west-1.amazonaws.com

Push image to ECR

docker push YOUR_AWS_ACCOUNT_ID.dkr.ecr.eu-west-1.amazonaws.com/playwright-aws-lambda-example

Create and deploy an AWS Lambda function with your newly created container image! ๐Ÿš€

playwright-aws-lambda-example's People

Contributors

lari avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

playwright-aws-lambda-example's Issues

InvalidEntrypoint

Hi

Thanks for the great tutorial.

when I try running the Lambda function, I get this error

{
"errorMessage": "RequestId: '' Error: fork/exec /entrypoint.sh: exec format error",
"errorType": "Runtime.InvalidEntrypoint"
}

Thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.