Skip to main content

PyPI version License: MIT

LAYERMAKE

layermake is a CLI tool for creating AWS Lambda layers

layermake currently supports creating python, NodeJS, and binary layers.

Requirements

Currently layermake has only been tested on Python >= 3.8

Installation:

Install from pypi: pip install layermake

or install from source:

git clone or download this repository and install with:

pip install .

The binary should now be installed and can be invoked with:

layermake COMMAND [ARGS]

Usage:

run layermake with one of the following commands:

  • nodejs
  • python
  • binary

layermake nodejs and layermake python support fully interactive layer building if no arguments are passed.

All commands share the following options:

  -n, --name TEXT                 layer name
  -l, --license TEXT              text to include in the license field of the layer
  --license-file TEXT             file containing license info to include in the license field of the layer
  -a, --arch [x86_64|arm64]       architectures this layer is compatible with
  --profile TEXT                  AWS profile to use when publishing
  -d, --description TEXT          description of the layer
  -v, --verbose                   verbose output
  -q, --quiet                     quiet output. Only display errors and warnings. Turn off animations.
  --no-publish                    do not publish the layer, only bundle.
  --no-zip                        do not publish the layer, and do not zip the bundled layer.

NodeJS bundling

To interactively bundle a NodeJS layer with defaults use: layermake nodejs

All NodeJS bundling options as displayed with layermake nodejs --help

To use a package.json file use the option --manifest or -m:

layermake nodejs -n "my nodejs layer" -r 14.x -m package.json
Usage: layermake nodejs [OPTIONS] [PACKAGES]...

Options:
  -n, --name TEXT            layer name
  -l, --license TEXT         text to include in the license field of the layer
  --license-file TEXT        file containing license info to include in the license field of the layer
  -a, --arch [x86_64|arm64]  architectures this layer is compatible with
  --profile TEXT             AWS profile to use
  -d, --description TEXT     description of the layer
  -v, --verbose              verbose output
  -q, --quiet                    quiet output. Only display errors and warnings. Turn off animations.
  --no-publish               do not publish the layer, only bundle.
  --no-zip                   do not publish the layer, and do not zip the bundled layer.
  -r, --runtime TEXT         nodejs runtime
  -m, --manifest TEXT        nodejs manifest file (package.json)
  -o, --output TEXT          target output directory  [default: layer]
  --container TEXT           use the provided docker container to build the layer
  --dir TEXT                 directory containing artifacts to bundle into a layer
  --help                     Show this message and exit.

Python bundling

To interactively bundle a Python layer with defaults use: layermake python

All Python bundling options as displayed with layermake python --help

Usage: layermake python [OPTIONS] [PACKAGES]...

Options:
  -n, --name TEXT            layer name
  -l, --license TEXT         text to include in the license field of the layer
  --license-file TEXT        file containing license info to include in the license field of the layer
  -a, --arch [x86_64|arm64]  architectures this layer is compatible with
  --profile TEXT             AWS profile to use
  -d, --description TEXT     description of the layer
  -v, --verbose              verbose output
  -q, --quiet                    quiet output. Only display errors and warnings. Turn off animations.
  --no-publish               do not publish the layer, only bundle.
  --no-zip                   do not publish the layer, and do not zip the bundled layer.
  -r, --runtime TEXT         python runtime
  -m, --manifest TEXT        python manifest file (requirements.txt)
  -o, --output TEXT          target output directory  [default: layer]
  --dir TEXT                 directory containing artifacts to bundle into a layer
  --container TEXT           use the provided docker container to build the layer
  --help                     Show this message and exit.

Binary bundling

Binary bundling requires an argument specifying either a build script or a directory where either a makefile exists or one of build, install, layer, build-layer exists (with or without a .sh file extensions). If none of these files are provided, you may pass a custom container command to run instead (e.g. /bin/bash my_script.sh).

When bundling a binary layer, the build script is responsible for installing libraries and binaries inside /opt/bin and/or /opt/lib. These directories are zipped inside Docker after running the build script.

Currently, only Docker images that provide yum package manager are supported as yum is used to install build tools in the base image (defaults to amazonlinux:latest)

To add any prerequisite packages not installed by the build script use the --packages flag to have them installed before bundling.

Example:

layermake binary -n 'GnuPG 2.8' -p zlib gnupg-build.sh
Usage: layermake binary [OPTIONS] [ARTIFACT]...

Options:
  -n, --name TEXT                 layer name
  -l, --license TEXT              text to include in the license field of the layer
  --license-file TEXT             file containing license info to include in the license field of the layer
  -a, --arch [x86_64|arm64]       architectures this layer is compatible with
  --profile TEXT                  AWS profile to use
  -d, --description TEXT          description of the layer
  -v, --verbose                   verbose output
  -q, --quiet                         quiet output. Only display errors and warnings. Turn off animations.
  --no-publish                    do not publish the layer, only bundle.
  --no-zip                        do not publish the layer, and do not zip the bundled layer.
  --dockerfile TEXT               use the provided dockerfile for bundling
  -o, --output TEXT               target output directory  [default: layer]
  -w, --workdir TEXT              workdir used when bundling inside the container  [default: /opt]
  -c, --cmd TEXT                  command executed inside the container; defaults to executing the build artifact with /bin/bash
  --base-image TEXT               use the provided base docker image when compiling the Dockerfile for lambda bundling
                                  [default: amazonlinux:latest]
  -p, --packages TEXT             additional packages to install in the container; currently only yum is supported
  -r, --runtimes [nodejs|nodejs4.3|nodejs6.10|nodejs8.10|nodejs10.x|nodejs12.x|nodejs14.x|nodejs16.x|java8|java8.al2|java11|python2.7|python3.6|python3.7|python3.8|python3.9|dotnetcore1.0|dotnetcore2.0|dotnetcore2.1|dotnetcore3.1|dotnet6|nodejs4.3-edge|go1.x|ruby2.5|ruby2.7|provided|provided.al2|nodejs18.x|all] compatible runtimes
  --help                          Show this message and exit.

Todo:

  • comprehensive unit testing
  • rust support
  • java support

Metadata

Release files for layermake 0.0.9

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for layermake 0.0.9
File Size Uploaded
layermake-0.0.9.tar.gz 13.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for layermake 0.0.9
File Interpreter ABI Platform
layermake-0.0.9-py3-none-any.whl Python 3 none any Details

Total release size: 29.4 kB

Release files / layermake-0.0.9.tar.gz

Download URL layermake-0.0.9.tar.gz
Size 13.8 kB
Tags Source
SHA-256 checksum
How to use checksums
c19303d9d22373ebcc081794da06299f24bc92841c33f760aff63478e75fdbc0
BLAKE2b-256 checksum
How to use checksums
1c96e0e7811c18de9d2d4c12ed9e37e37b561212998780d5981fceea247748e7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.18

Release files / layermake-0.0.9-py3-none-any.whl

Download URL layermake-0.0.9-py3-none-any.whl
Size 15.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5f4fb37e26345bc3a6068bd44bde7c2fc47c8fead06d0c2c49cc8de365ebfc67
BLAKE2b-256 checksum
How to use checksums
bfb1d65009049e0b730c93f130fdaa3e9d2307d37b5950d1e493f2c5c3e567fb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.18

Release history Release notifications | RSS feed

This release

0.0.9 This release

2 release files

0.0.8

2 release files

0.0.7

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page