DEV Community

Discussion on: Make your lambda functions lightweight

Collapse
 
imewish profile image
Vishnu Prassad

We have tried lambda layers to manage node_modules eariler, and over the time it became very hard to manage it. Also every lamda which uses the same layer have to unpack the modules which are actually not needed for it. Layer can help with reducing size during deployment, but if the total size of lamdba code + layers cannot exceed 250mb.

Webpack does the job very neatly to handle the node_modules and helps to reduce the size of the functions by keeping only the required node_modules and files needed by it.

I have found layers useful when you have to run thirdparty binaries/modules which are not availbe via NPM, such as FFMPEG/SHARP etc.