npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@mwillbanks/pulumi-aws-lambda-layer-builder

v0.5.24

Published

A Pulumi package for building AWS Lambda layers with TypeScript.

Readme

pulumi-aws-lambda-layer-builder

A reusable Pulumi package for building AWS Lambda layers from arbitrary system packages. It leverages the Pulumi Docker provider to install, extract, and package only the files you need—then publishes them as versioned Lambda layers via the AWS provider.


🚀 Features

  • Configurable base image: Use any public or private image (e.g., amazonlinux:2023 or your own custom builder image).
  • Selective file extraction: Leverages repoquery and configurable filters (BINARIES, LIBRARIES, SHARED, CONF, or ALL) to minimize layer size.
  • Automatic versioning: Content-based hash on your Dockerfile ensures layers rebuild only when configuration changes.
  • Pulumi-native: Pure TypeScript API, integrates with both the Pulumi Docker and AWS providers.
  • Dual ESM/CJS: Ships both CommonJS and ES module builds for maximum compatibility.

📦 Installation

npm install @mwillbanks/pulumi-aws-lambda-layer-builder

or, if using a Git-based workflow:

npm install git+ssh://github.com/mwillbanks/pulumi-aws-lambda-layer-builder.git

⚙️ Usage

import * as aws from "@pulumi/aws";
import { buildLambdaLayer } from "@mwillbanks/pulumi-aws-lambda-layer-builder";

const layer = buildLambdaLayer({
  name: "openssl",
  imageName: "amazonlinux:2023",
  packages: [
    ["openssl11", "*"],
    ["zip", { bin: true, lib: true }],
  ],
  runtimes: [aws.lambda.Runtime.NODEJS_20_X],
  architectures: [aws.lambda.Architecture.X86_64],
});

Configuration Options

| Option | Type | Description | | ------------------- | ------------------------------------- | ------------------------------------------------------------------------ | | name | string | Logical name for the layer (used in directory, image, and layer naming). | | imageName | string | A docker.RemoteImage name. | | imageArgs | docker.RemoteImageArgs | Additional arguments to supply for docker.RemoteImage | | packages | [string, LayerBuilderPackageOpts][] | List of packages to install and their extraction filters. | | runtimes? | aws.lambda.Runtime[] | Lambda runtimes that can use this layer. Defaults to none. | | architectures? | aws.lambda.Architecture[] | CPU architectures for the layer. Defaults to none. | | prefixProjectName | boolean | Prepend <project>- to the layer name. Default: true. | | prefixProjectEnv | boolean | Prepend <stack>- to the layer name. Default: true. | | awsProvider | aws.Provider | Optional AWS provider when using multiple regions. Default undefined |

LayerBuilderPackageOpts:

  • "*" — include all files from the package
  • { bin?, include?, lib?, shared?, conf?, manualDownloadUrl? } — selectively include only bins, includes (/usr/include, /include), libs (/usr/lib64, /usr/lib, /lib), shares (/usr/share), or configs (/etc) or manually download the package file for installation through a local package manager repository.

🔍 How It Works

  1. Dockerfile Rendering: Builds a tailored Dockerfile using your options and repoquery filters.
  2. Extraction: The container packages /tmp/layer into layer.zip using zip.
  3. Versioning: A SHA‑256 of the Dockerfile produces an 8‑character hash to avoid unnecessary rebuilds.
  4. Publishing: Pulumi AWS provider publishes a new aws.lambda.LayerVersion with the given name, code, runtimes, and architectures.

🛠️ Best Practices

  • Pin base images to explicit versions (e.g., amazonlinux:2023.0.20230413) to ensure reproducible builds.
  • Limit filters to only what you need—avoid "*", unless necessary.
  • Commit your layers/ folder so zip artifacts, and hash files live alongside code and you don't have to unnecessarily regenerate new layers.
  • Use clear naming conventions by toggling prefixProjectName and prefixProjectEnv to suit your environment.

🤝 Contributing

  1. Fork the repo
  2. npm install
  3. npm run build
  4. Write tests in test/ and update README.md
  5. Send a PR — we use conventional commits and semantic versioning.

📄 License

MIT © Mike Willbanks