10000 GitHub - cbschuld/sharp-aws-lambda-layer at e7294acc232ce22163679b778ab92ffcf5defea2
[go: up one dir, main page]

Skip to content

Prebuilt Sharp AWS Lambda Layer for Node.js 18, 20, and 22. Optimized, bundled, and minified Sharp binaries for x86_64 and arm64 architectures. Improve cold starts with lightweight Sharp builds, ready for Serverless Framework, AWS SAM, and SST deployments.

License

Notifications You must be signed in to change notification settings

cbschuld/sharp-aws-lambda-layer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AWS Sharp Lambda Layer (x86_64 and arm64)

Prebuilt Sharp AWS Lambda Layer for Node.js 18, 20, and 22. Optimized, bundled, and minified Sharp binaries for x86_64 and arm64 architectures. Improve cold starts with lightweight Sharp builds, ready for Serverless Framework, AWS SAM, and SST deployments.

About

A pre-built sharp AWS Lambda layer optimized for cold start performance.

  • Supports x86_64 and arm64 architectures.
  • Compatible with Node.js 18.x, 20.x, and 22.x runtimes.
  • Automatically updated and tested using GitHub Actions.
  • Bundled and minified with esbuild.
  • Lightweight layer files (~7MB).

Features

  • Separate builds for x64 and arm64.
  • Auto-release on new sharp versions.
  • Fully optimized for AWS Lambda cold start times.
  • Ideal for use with SST, AWS SAM, and Serverless Framework.

Why Separate Builds?

Bundling dependencies and targeting the correct architecture reduces cold start latency dramatically. See Optimizing Node.js dependencies in AWS Lambda for more.

Download

Releases include:

Each file contains a ready-to-use layer for deployment.

Usage

Basic Import

import sharp from 'sharp';

AWS Lambda Layer Setup

Check AWS Lambda Layers documentation.

Publishing a Layer (CLI Example)

aws lambda publish-layer-version \
  --layer-name sharp-lambda-x64 \
  --description "Sharp Layer for x86_64" \
  --license-info "Apache-2.0" \
  --zip-file fileb://release-x64.zip \
  --compatible-runtimes nodejs18.x nodejs20.x nodejs22.x \
  --compatible-architectures x86_64

aws lambda publish-layer-version \
  --layer-name sharp-lambda-arm64 \
  --description "Sharp Layer for arm64" \
  --license-info "Apache-2.0" \
  --zip-file fileb://release-arm64.zip \
  --compatible-runtimes nodejs18.x nodejs20.x nodejs22.x \
  --compatible-architectures arm64

SST Usage Example

layers: [
  new lambda.LayerVersion(stack, "SharpLayer", {
    code: lambda.Code.fromAsset("layers/sharp"),
    compatibleArchitectures: [lambda.Architecture.ARM_64],
  })
]

AWS SAM Usage Example

SharpLayer:
  Type: AWS::Serverless::LayerVersion
  Properties:
    LayerName: sharp
    ContentUri: layers/sharp/release-arm64.zip
    CompatibleArchitectures:
      - arm64
    CompatibleRuntimes:
      - nodejs18.x
      - nodejs20.x
      - nodejs22.x

Building (Optional)

Layers are built automatically by GitHub Actions when a new Sharp version is released.

If needed manually:

git clone https://github.com/cbschuld/sharp-aws-lambda-layer.git
cd sharp-aws-lambda-layer
# Follow the GitHub Actions workflows for build instructions.

(No local package.json is provided.)

License

Apache License 2.0 - http://www.apache.org/licenses/LICENSE-2.0

Refere 6464 nces

About

Prebuilt Sharp AWS Lambda Layer for Node.js 18, 20, and 22. Optimized, bundled, and minified Sharp binaries for x86_64 and arm64 architectures. Improve cold starts with lightweight Sharp builds, ready for Serverless Framework, AWS SAM, and SST deployments.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published
0