-
Notifications
You must be signed in to change notification settings - Fork 293
Add AWS Lambda Layer Support #310
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@david-mk-lawrence Thanks for the PR, I was looking exactly for this feature myself. What's the reason for creating two options though (inject and layers)? It looks to me there are only two setting that make sense:
The two other "possible" settings (possible in terms of the serverless.yaml):
I'd suggest you reduce it down to one option, "layers", which is false by default and when true(ish), it disables injection and enables layers. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I love the simplicity of this implementation, great job!!
The main changes I want made before I merge this:
- remove the
inject
option, base all behavior on thelayer
option - add yourself to the contributors list!
- respond to the 2 code comments (both are 100% open for discussion)
…fined, serverless core will remove it when creating the layer.)
@rbu Thanks for the feedback! Yes, that is a good point and I've removed that. Now the The reason I put it there initially is because I found it very useful to prevent the injection from occurring while developing. But now that the layer is working, it shouldn't be needed. |
…7, python3.6 and python3.7
probably on monday 🙂 |
@dschep That would make a great start of the week for me. Appreciated. Thanks for merging this so fast 🍻 |
🚀 Shipped v4.3.0!!!! |
I really like this feature that i can create layers for my lambda function that easily. The only thing i am missing is that i can just include one layers. Would it be possible to create more then one layer so i can distribute my dependencies over several functions in a modular way. The plugin already allows to define function specific requirements for multi function projects. :) |
Any plans on adding support for defining multiple layers and including only certain packages in a layer? |
This provides the option to place the requirements into a lambda layer.
2 additional options have been added:
inject
: boolean. Controls whether the requirements should be injected into the build. Defaults totrue
layer
: boolean | object: Indicates that the requirements should not be injected into the build (will setinject = false
when this option is present), and instead build separately to be used a lambda layer. Defaultsfalse
When the
layer
option is provided as a booleantrue
, then some defaults will be chosen for the layer, and the layer will be added to the globallayers
object in serverless.yml.When
layer
is provided as an object, then the values will be merged onto the defaults.The layer will be created in the Cloudformation stack as
PythonRequirementsLambdaLayer
. In order to use the layer in a function, add the reference to the layer in the function'slayers
section. e.g.Future Improvements/ Limitations of this implementation: