Manvel / lambda-pptr

Project for experimenting with launching puppeteer in lambda.

Home Page:https://epgq5dsmc7.execute-api.us-west-2.amazonaws.com/default/lambda-pptr-experiment-container

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

lambda-pptr

Current project is just an experiment for running puppeteer in the AWS Lambda environment.

About

  • index.js is the entry point, the code in handler function is the one that is executed when the lambda is invoked.
  • Visit current url to invoke the lambda function.
  • The deployment happens automatically each time code lands on main branch, see Deploy step in publish job.(We do containers now, README to be updated)

Local smoke test

npm test

Testing container

docker build --platform linux/amd64 -t lambda-pptr-experiment-container-private:staging .
docker run --read-only -p 9000:8080 lambda-pptr-experiment-container-private:staging

Trigger the entrypoint invocation from another terminal session.

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

Publishing to ECR

docker build --platform linux/x86_64 -t lambda-pptr-experiment-container-private:0.3.3 .
docker tag lambda-pptr-experiment-container-private:0.3.3 ${{AWS_IAM_ID}}.dkr.ecr.us-west-2.amazonaws.com/lambda-pptr-experiment-container-private:0.3.3
docker push ${{AWS_IAM_ID}}.dkr.ecr.us-west-2.amazonaws.com/lambda-pptr-experiment-container-private:0.3.3

AWS setup

Setup Lambda functions and API Gateway

Step 1 - search for lambda

Step 2 - click create function

Step 3 - set function name, click create

Step 4 - add trigger

Step 5 - select API Gateway, click add

Step 6 - open API Gateway

Step 7 - API Gateway setup ready

Setup deployment pre-requisites

Step 1 - search for IAM

Step 2 - click identity provider

Step 3 - click add provider

Step 4 - setup provider

Step 5 - get ARN

Step 6 - search for roles

Step 7 - create new role

Step 8 - create trusted entity

Step 9 - create new policy

Step 10 - update function code permission

Step 11 - specify ARN

Step 12 - create policy

About

Project for experimenting with launching puppeteer in lambda.

https://epgq5dsmc7.execute-api.us-west-2.amazonaws.com/default/lambda-pptr-experiment-container


Languages

Language:JavaScript 73.6%Language:Dockerfile 26.4%