This AWS lambda layer contains a pre-built better-sqlite3 npm library. It is optimized for the smallest space usage possible.
better-sqlite3 version | Layer size |
---|---|
7.1.0 | 0.87MB |
A pre-built layer zip file is available at dist/better-sqlite3-layer.zip
.
- Docker
- Clone the repo:
git clone [email protected]:Umkus/lambda-layer-better-sqlite3.git cd lambda-layer-better-sqlite3/
- Install dependencies:
docker run -v "$PWD":/var/task lambci/lambda:build-nodejs12.x npm --no-optional --no-audit --progress=false install
- Build the layer:
docker run -v "$PWD":/var/task lambci/lambda:build-nodejs12.x node ./node_modules/webpack/bin/webpack.js
- Perform a smoke-test:
docker run -w /var/task/dist/nodejs -v "$PWD":/var/task lambci/lambda:build-nodejs12.x node -e "console.log(require('better-sqlite3'))"
- Import created layer into your AWS account:
aws lambda publish-layer-version --layer-name better-sqlite3 --description "better-sqlite3 layer" --license-info "Apache License 2.0" --zip-file fileb://dist/better-sqlite3-layer.zip --compatible-runtimes nodejs12.x