Oliver Nassar

Public AWS Lambda Function Layers

January 17, 2024 Updated: November 20, 2026

While migrating some AWS Lambda Functions between AWS accounts, I had to do the inevitable: re-create the Layers for the respective functions. While doing so, I remembered that there are a handful of public layers that I used in production environments in the past (e.g. chrome-aws-lambda, wkhtmltopdf) that I never had to compile, add to AWS, etc.

This got me thinking that the layers I'm using for my functions might be useful for others. So I'm going to list them below (along with their public ARN so that anyone can use them). You'll also find a bit of context when required (e.g. object instantiation instructions).

I'll try and maintain this page as I add more NPM libraries to my AWS Lambda Functions, or if I use other public Layers.

Note: Layers mentioned on this page have been tested on either Node.js 18 or Node.js 20. Public region availablity is currently limited to us-west-2. Please email me if you'd like any of the layers available in another region: onassar@gmail.com

amazon_linux_fonts (n/a)

  • Library name: Amazon Linux Fonts
  • Version: (n/a)
  • Description: Library to help render fonts within AWS
  • ARN: arn:aws:lambda:us-west-2:347599033421:layer:amazon_linux_fonts:1
  • AWS Region: us-west-2
  • Maintained by me: ❌
  • Notes: Nothing required here, other than adding the Layer to your Lambda Function.
  • Instantiation: (n/a)

chardet v2.1.0

  • Library name: Node Chardet (GitHub, NPM)
  • Version: v2.1.0
  • Description: Character detection
  • ARN: arn:aws:lambda:us-west-2:339713137814:layer:chardet-v2_1_0:1
  • AWS Region: us-west-2
  • Maintained by me: ✅
  • Notes: (none)
  • Instantiation:
import chardet from 'chardet';
export const handler = async function(event, context, callback) {
    console.log(chardet)
};

cheerio v1.0.0-rc10

  • Library name: Cheerio JS (GitHub, NPM, website)
  • Version: v1.0.0-rc10
  • Description: HTML parsing
  • ARN: arn:aws:lambda:us-west-2:339713137814:layer:cheerio-v1_0_0-rc10:5
  • AWS Region: us-west-2
  • Maintained by me: ✅
  • Notes: (none)
  • Instantiation:
import cheerio from '/opt/node_modules/cheerio/lib/index.js';
export const handler = async function(event, context, callback) {
    cheerio.load('content');
};

chromium v119.0.2

  • Library name: Chromium (GitHub, NPM, website)
  • Version: v119.0.2
  • Description: Open source browser
  • ARN: arn:aws:lambda:us-west-2:339713137814:layer:chromium-v119_0_2:1
  • AWS Region: us-west-2
  • Maintained by me: ✅
  • Notes: This ARN is using a specifically compiled one by @Sparticuz
  • Instantiation:
import chromium from '@sparticuz/chromium';
export const handler = async function(event, context, callback) {
    console.log(await chromium.executablePath());
};

chromium v153.0.0

  • Library name: Chromium (GitHub, NPM, website)
  • Version: v153.0.0
  • Description: Open source browser
  • ARN: arn:aws:lambda:us-west-2:339713137814:layer:chromium-v153_0_0:1
  • AWS Region: us-west-2
  • Maintained by me: ✅
  • Notes: Built from the x64 layer zip released by @Sparticuz, repackaged with node_modules at the root. Requires an x86_64 function on Node.js 22 or 24. Pairs with puppeteer-core v25.11.0
  • Instantiation:
import chromium from '@sparticuz/chromium';
export const handler = async function(event, context, callback) {
    console.log(await chromium.executablePath());
};

colorthief v3.3.1

  • Library name: Color Thief (GitHub, NPM, website)
  • Version: v3.3.1
  • Description: Extract dominant colors and palettes from images
  • ARN: arn:aws:lambda:us-west-2:339713137814:layer:colorthief-v3_3_1:1
  • AWS Region: us-west-2
  • Maintained by me: ✅
  • Notes: In Node.js, Color Thief uses sharp (>=0.33.0) to decode images, so add the sharp v0.35.1 layer to your function as well. Only the async functions (getColor, getPalette, getSwatches) work in Node.js
  • Instantiation:
import { getColor, getPalette } from 'colorthief';
export const handler = async function(event, context, callback) {
    let color = await getColor(data);
    let palette = await getPalette(data, {colorCount: 6});
    console.log(color?.hex(), (palette ?? []).map(c => c.hex()));
};

follow-redirects v1.14.6

  • Library name: Follow Redirects (GitHub, NPM)
  • Version: v1.14.6
  • Description: Redirect following
  • ARN: arn:aws:lambda:us-west-2:339713137814:layer:follow_redirects-v1_14_6:5
  • AWS Region: us-west-2
  • Maintained by me: ✅
  • Notes: (none)
  • Instantiation:
import pkg from '/opt/node_modules/follow-redirects/index.js';
const {http, https} = pkg;
export const handler = async function(event, context, callback) {
    https.request(url, options, callback);
};

iconv-lite v0.6.3

  • Library name: Node Chardet (GitHub, NPM)
  • Version: v0.6.3
  • Description: Character encoding and conversion
  • ARN: arn:aws:lambda:us-west-2:339713137814:layer:iconv_lite-v0_6_3:1
  • AWS Region: us-west-2
  • Maintained by me: ✅
  • Notes: (none)
  • Instantiation:
import iconv from 'iconv-lite';
export const handler = async function(event, context, callback) {
    console.log(iconv)
};

jszip v3.10.1

  • Library name: JSZip (GitHub, NPM, website)
  • Version: v3.10.1
  • Description: Create, read and edit .zip files
  • ARN: arn:aws:lambda:us-west-2:339713137814:layer:jszip-v3_10_1:5
  • AWS Region: us-west-2
  • Maintained by me: ✅
  • Notes: (none)
  • Instantiation:
import * as JSZip from '/opt/node_modules/jszip/lib/index.js';
export const handler = async function(event, context, callback) {
    let zip = new JSZip.default();
};

pdf-parse v1.1.1

  • Library name: pdf-parse (GitLab, NPM)
  • Version: v1.1.1
  • Description: PDF manipulation and extraction library.
  • ARN: arn:aws:lambda:us-west-2:339713137814:layer:pdf_parse-v1_1_1:1
  • AWS Region: us-west-2
  • Maintained by me: ✅
  • Notes: (none)
  • Instantiation:
import pdf from 'pdf-parse/lib/pdf-parse.js';
export const handler = async function(event, context, callback) {
    let options = {};
    options.max = 4;
    pdf({content}, options).then(function(pdfData) {
        console.log(pdfData);
    }).catch(function(err) {
    })
};

pdf2json v3.1.5

  • Library name: pdf2json (GitHub, NPM)
  • Version: v3.1.5
  • Description: PDF manipulation and extraction library.
  • ARN: arn:aws:lambda:us-west-2:339713137814:layer:pdf2json-v3_1_5:1
  • AWS Region: us-west-2
  • Maintained by me: ✅
  • Notes: (none)
  • Instantiation:
import pdf2json from 'pdf2json';
export const handler = async function(event, context, callback) {
    let promise = new Promise(function(resolve, reject) {
        let pdfParser = new pdf2json(this, 1),
            obj = {};
        pdfParser.on('readable', function(metadata) {
            console.log(metadata);
            obj.metadata = metadata;
        });
        pdfParser.on('pdfParser_dataError', function(err) {
            console.log(err);
            reject(null);
        });
        pdfParser.on('pdfParser_dataReady', function(pdfData) {
            obj.pageCount = pdfData?.Pages?.length ?? null;
            obj.textContent = pdfParser.getRawTextContent();
            obj.textContent = obj.textContent.replace(/\r\n/g, '\n');
            obj.textContent = obj.textContent.replace(/\s+/g, ' ').trim();
            resolve(obj);
        });
        pdfParser.parseBuffer(response.raw);
    });
    promise.then(function(obj) {
        console.log(obj)
    });
};

puppeteer-core v21.5.1

  • Library name: Puppeteer Core (GitHub, NPM, website)
  • Version: v21.5.1
  • Description: Helper library for working with Chrome / Chromium
  • ARN: arn:aws:lambda:us-west-2:339713137814:layer:puppeteer_core-v21_5_1:1
  • AWS Region: us-west-2
  • Maintained by me: ✅
  • Notes: (none)
  • Instantiation:
import puppeteer from 'puppeteer-core';
export const handler = async function(event, context, callback) {
    let browser = await puppeteer.launch({...});
};

puppeteer-core v25.11.0

  • Library name: Puppeteer Core (GitHub, NPM, website)
  • Version: v25.11.0
  • Description: Helper library for working with Chrome / Chromium
  • ARN: arn:aws:lambda:us-west-2:339713137814:layer:puppeteer_core-v25_11_0:1
  • AWS Region: us-west-2
  • Maintained by me: ✅
  • Notes: Targets Chromium 153.0.8010.36, so it pairs with chromium v153.0.0. Requires Node.js 22 or 24
  • Instantiation:
import chromium from '@sparticuz/chromium';
import puppeteer from 'puppeteer-core';
export const handler = async function(event, context, callback) {
    let browser = await puppeteer.launch({
        args: chromium.args,
        executablePath: await chromium.executablePath(),
        headless: true
    });
};

sharp v0.29.3

  • Library name: Sharp (GitHub, NPM, website)
  • Version: v0.29.3
  • Description: High performance Node.js image processing
  • ARN: arn:aws:lambda:us-west-2:339713137814:layer:sharp-v0_29_3:5
  • AWS Region: us-west-2
  • Maintained by me: ✅
  • Notes: (none)
  • Instantiation:
import sharp from '/opt/node_modules/sharp/lib/index.js';
export const handler = async function(event, context, callback) {
    await sharp(data).resize(width).toBuffer().then(function(buffer) {
        ...
    });
};

sharp v0.35.1

  • Library name: Sharp (GitHub, NPM, website)
  • Version: v0.35.1
  • Description: High performance Node.js image processing
  • ARN: arn:aws:lambda:us-west-2:339713137814:layer:sharp-v0_35_1:3
  • AWS Region: us-west-2
  • Maintained by me: ✅
  • Notes: Requires Node.js 20.9.0 or later
  • Instantiation:
import sharp from 'sharp';
export const handler = async function(event, context, callback) {
    let buffer = await sharp(data).resize(width).toBuffer();
};

sugar v2.0.6

  • Library name: Sugar.js (GitHub, NPM, website)
  • Version: v2.0.6
  • Description: Library for working with native objects
  • ARN: arn:aws:lambda:us-west-2:339713137814:layer:sugar-v2_0_6:5
  • AWS Region: us-west-2
  • Maintained by me: ✅
  • Notes: (none)
  • Instantiation:
import Sugar from 'sugar';
import SugarLocales from 'sugar/locales/index.js';
export const handler = async function(event, context, callback) {
    let parsedDate = Sugar.Date.create('dateTime');
};

ua-parser-js v2.0.10

  • Library name: UAParser.js (GitHub, NPM, website)
  • Version: v2.0.10
  • Description: User-agent parsing (browser, engine, OS, CPU and device)
  • ARN: arn:aws:lambda:us-west-2:339713137814:layer:ua_parser_js-v2_0_10:1
  • AWS Region: us-west-2
  • Maintained by me: ✅
  • Notes: Version 2 is licensed under AGPL-3.0-or-later (version 1 was MIT)
  • Instantiation:
import { UAParser } from 'ua-parser-js';
export const handler = async function(event, context, callback) {
    let result = UAParser(event.headers['user-agent']);
    console.log(result.browser, result.os, result.device);
};

wkhtmltox v0.12.6

  • Library name: wkhtmltopdf (GitHub, NPM, website)
  • Version: v0.12.6
  • Description: Utility to convert HTML to PDF
  • ARN: arn:aws:lambda:us-west-2:339713137814:layer:wkhtmltox-v0_12_6_4:1
  • AWS Region: us-west-2
  • Maintained by me: ✅
  • Notes: This library is also known as wkhtmltopdf. It also includes the library wkhtmltoimage. This Layer exposes these libraries within the request, which can be made using child_process.
  • Instantiation:
let child_process = require('child_process'),
    command = '/opt/bin/wkhtmltopdf ' + (inputPath) + ' - | cat',
    properties = {
        encoding: 'buffer',
        maxBuffer: 1024 * 1024 * 10
    };
child_process.exec(command, properties, function(error, stdout, stderr) {
    ...
});

Command to share layer:

Below is a sample bash command to share a Layer (I couldn't find the option in the AWS console to do so). You may need to change /usr/bin/aws to aws or something similar.

AWS_ACCESS_KEY_ID={{key}} AWS_SECRET_ACCESS_KEY={{secret}} /usr/bin/aws lambda add-layer-version-permission \
  --layer-name {{layerName}} \
  --principal '*' \
  --action lambda:GetLayerVersion \
  --version-number {{layerVersion}} \
  --statement-id public \
  --region {{region}}

Example:

AWS_ACCESS_KEY_ID={{key}} AWS_SECRET_ACCESS_KEY={{secret}} /usr/bin/aws lambda add-layer-version-permission \
  --layer-name pdf2json-v3_1_5 \
  --principal '*' \
  --action lambda:GetLayerVersion \
  --version-number 1 \
  --statement-id public \
  --region us-west-2