Skip to content

Instantly share code, notes, and snippets.

@abhagsain
Created May 22, 2022 06:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save abhagsain/37d3f8a0cd7a93b05ab42da90177c070 to your computer and use it in GitHub Desktop.
Save abhagsain/37d3f8a0cd7a93b05ab42da90177c070 to your computer and use it in GitHub Desktop.
How to use Lambda Layer With Serverless Framework
org: abhagsain
app: abhagsain-app
service: abhagsain-app
frameworkVersion: "3"
provider:
name: aws
runtime: python3.8
httpApi:
cors: true
layers:
mylayers:
path: my-layers # This is the name of the folder in the current directory.
functions:
create_user:
memorySize: 512
handler: handler.create_user
environment: ${file(env.json)}
layers:
# This should refer to the layer name in the layers section. It should be named as PascalCase (First letter of the word should be uppercase) and should end with 'LambdaLayer'
- { Ref: MylayersLambdaLayer }
- arn:aws:lambda:us-east-1:770693421928:layer:Klayers-python38-spacy:42 # And you can refer to public layers as well. Max of 5 layers can be referred
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment