shelfio / chrome-aws-lambda-layer

58 MB Google Chrome to fit inside AWS Lambda Layer compressed with Brotli
MIT License
664 stars 46 forks source link
aws aws-lambda chromium lambda-layer

Google Chrome for AWS Lambda as a layer

58 MB Google Chrome to fit inside AWS Lambda Layer compressed with Brotli

Sparticuz/chromium published as a Lambda Layer.

Tested with Node.js 16x/18x. Compatible with x86_64 only. Has Chromium v131.0.0

Getting Started

Click on Layers and choose "Add a layer", and "Provide a layer version ARN" and enter the following ARN.

arn:aws:lambda:us-east-1:764866452798:layer:chrome-aws-lambda:50

When importing the module within lambda, make sure you import @sparticuz/chromium not chrome-aws-lambda

const chromium = require('@sparticuz/chromium');

package.json

lambda container settings:

layers: [LayerVersion.fromLayerVersionArn(this, 'chromium-lambda-layer',
  'arn:aws:lambda:us-east-1:764866452798:layer:chrome-aws-lambda:50'
)]

In the deployed lambda code You can just use a regular ES6 or CommonJS import statement for @sparticuz/chrome-aws-lambda, and just use as indicated.

Available regions

License

MIT © Shelf