I have an error Code storage limit exceeded deploy the serverless application in AWS. Total size 409 B.
The error message says:
An error occurred: HelloLambdaFunction - Code storage limit exceeded. (Service: AWSLambda; Status Code: 400; Error Code: CodeStorageExceededException; Request ID: ...)
There is a hard limit of 6mb when it comes to AWS Lambda payload size. This means we cannot send more than 6mb of data to AWS Lambda in a single request. Developers will typically run into this limit if their application was using AWS Lambda as the middle man between their client and their AWS S3 asset storage.
Today, we are announcing that AWS Lambda now allows you to configure ephemeral storage ( /tmp ) between 512 MB and 10,240 MB.
Function configuration, deployment, and executionThey cannot be changed. The Lambda documentation, log messages, and console use the abbreviation MB (rather than MiB) to refer to 1024 KB. 128 MB to 10,240 MB, in 1-MB increments. This quota applies to all the files you upload, including layers and custom runtimes.
With increased concurrent execution limit, there is still one more limit the Burst Concurrency limit. This will limit lambda to serve only 3000 concurrent request at time. If it receives more than 3000 concurrent requests some of them will be throttled until lambda scales by 500 per minute.
Looking specifically for this problem related to serverless, I found https://github.com/serverless/serverless/issues/400. It is a known problem of the serverless framework. However, some enterprising individual created a solution to the problem with a plugin that is able to prune old versions: https://github.com/claygregory/serverless-prune-plugin. This allows you to clean up the old versions and code storage without deleting the entire stack.
For example, you can delete all but the last 10 versions using:
sls prune -n 10
There are further options for restricting by stage or region. Even better it is possible to integrate the plugin into the deploy to automatically remove all but x versions.
I used this plugin for my current serverless project and it delivered on the promise.
From PublishVersion - AWS Lambda, CodeStorageExceededException
means:
You have exceeded your maximum total code size per account.
From AWS Lambda Limits - AWS Lambda:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With