just installed aws-iot-device-sdk-v2
into my lambda cluster. I am able to install the package just fine into the project. Unfortunately, I got the error An error occurred: exampleLambda - Resource handler returned message: "Unzipped size must be smaller than 262144000 bytes (Service: Lambda, Status Code: 400, Request ID: ...
Looking at serverless, I see that the inclusion increased my package size from 36MB too 92MB. This doesn't seem right at all. Our team has installed over one hundred packages but none of them have increased our deployed memory size this much. Is there some work-around for this problem?
Yes, there is a limitation of 250 MB of code and dependencies when it is unzipped. We do provide a zipped file of code along with dependencies, but behind the scene it gets unzipped.
Best practice: Keep the lambda size small as possible and orchestrate as per flow rather than doing everything in one Lambda. Large size lambda do affect the initialization (cold start)
Workaround:
If none of this work, keep the large dependencies in S3 and load it to /tmp directory and the use it. This is not a good solution, but will work. I have used it for setting up a selenium dependency in Java.
Also, I am open for other solutions from the community. Thanks!