Created
April 21, 2024 23:49
-
-
Save CharlieGreenman/ec8ca79c42bd96b7dc3387adcb190ea4 to your computer and use it in GitHub Desktop.
Typescript x Node Lambda Layers - Syntax for creating a lambda layer that uses a makefile to build typescript
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# file path of makefile: src/functions/shared/Makefile | |
build-SharedLambdaLayer: | |
rm -Rf node_modules | |
npm install | |
npm run build | |
cp -rf dist/* ${ARTIFACTS_DIR} | |
npm prune --production | |
cp -rf node_modules ${ARTIFACTS_DIR} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SharedLambdaLayer: | |
Type: AWS::Serverless::LayerVersion | |
Properties: | |
LayerName: shared-lambda-layer | |
Description: Shared Lambda Layer | |
ContentUri: src/functions/shared | |
CompatibleRuntimes: | |
- nodejs20.x | |
Metadata: | |
BuildMethod: makefile |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Note, aws lambda will use index.handler by default, so even though
AWS::Serverless::LayerVersion
does not allow an index handler, as long as code in index.js this will work 💯