Serverless Framework - Shrink deployment artifact … the shortest story ever
If you start coding with the Serverless Framework you will come to a point where you have several Lambda Functions and maybe Step Functions. Anyway you will notice that the size of the deployment artifact soon gets very big. For me it was something about 26MB, which is way to much for some hundred lines of JavaScript Code, right? By the way with my connection at home I was not able to deploy the stuff on AWS anymore because it ran in timeouts.
Luckily I found the serverless optimize plugin which shrank my deployment artifact from about 26MB to something about 200KB, awesome huh?
The only thing you have to do is adding the respective dependency with
npm install serverless-plugin-optimize --save
and also add it to the plugin section of your serverless.yml
plugins:
- serverless-plugin-optimize
And that’s all it takes! Have fun deploying your Lambda/Step Functions with the speed of light from now on …
Cheers
Noah