- Neueste
- Die meisten Stimmen
- Die meisten Kommentare
Although both can work, my recommendation would be to place all your code into the Lambda function. One of the factors that affects cold start time is package size. The package size incudes all the layers. By having all the code in a layer and including it in all functions, you pay extra cold start times for all functions. You should create smaller functions that each includes only what they need. Also, if you make a change to the business logic in one component, you will need to update all functions, which just adds to complexity.
You should use layers for things like common 3rd party libraries that you need to use across all functions. Things like monitoring.
Also would like to add that by default you're limited to five layers per lambda. So if you have a sizeable app (i.e. more than a couple models) you likely won't be able to attach everything you would need to the lambdas that need to do the processing.
https://docs.aws.amazon.com/lambda/latest/dg/invocation-layers.html
Relevanter Inhalt
- AWS OFFICIALAktualisiert vor einem Jahr
- AWS OFFICIALAktualisiert vor einem Jahr
- AWS OFFICIALAktualisiert vor einem Jahr
- AWS OFFICIALAktualisiert vor 10 Monaten
Thank you for the help. I am seeing how over using the layers can cause problems in the production in the future. I am going to have repositories and 3rd party utility functions in layers and business logic in lambda functions.