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.
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).
- Separate builds for
x64
andarm64
. - Auto-release on new
sharp
versions. - Fully optimized for AWS Lambda cold start times.
- Ideal for use with SST, AWS SAM, and Serverless Framework.
Bundling dependencies and targeting the correct architecture reduces cold start latency dramatically. See Optimizing Node.js dependencies in AWS Lambda for more.
Releases include:
Each file contains a ready-to-use layer for deployment.
import sharp from 'sharp';
Check AWS Lambda Layers documentation.
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
layers: [
new lambda.LayerVersion(stack, "SharpLayer", {
code: lambda.Code.fromAsset("layers/sharp"),
compatibleArchitectures: [lambda.Architecture.ARM_64],
})
]
SharpLayer:
Type: AWS::Serverless::LayerVersion
Properties:
LayerName: sharp
ContentUri: layers/sharp/release-arm64.zip
CompatibleArchitectures:
- arm64
CompatibleRuntimes:
- nodejs18.x
- nodejs20.x
- nodejs22.x
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.)
Apache License 2.0 - http://www.apache.org/licenses/LICENSE-2.0