Lambda function is nearing memory limit
Why do I see this?
One of your Lambda functions has utilized 80% or more of the allocated memory within the last 24 hours.
What does this mean?
AWS Lambda service lets you configure the amount of memory whenever you deploy a Lambda function. To minimize the Lambda cost you might go for a memory configuration that doesn't leave your function with too much of unused memory.
If your function uses more memory than what you have configured, it might be stopped abruptly by the AWS Lambda service.
This event notifies you when the memory usage of your function in the last 24 hours is greater than or equal to 80% of the total allocated memory. This will prevent you from reaching a point where high memory usage by your Lambda function results in a string of errors.
How do I fix “Lambda function is nearing memory limit”?
If you were notified of this event for any of your Lambda functions, you will have to figure out and configure an appropriate amount of memory for it. To do that, you will need to understand your function's memory requirements and usage.
You can manually run tests on the function by selecting different memory allocations and measuring the execution time of your function. The memory allocation that leads to the lowest execution time is the ideal configuration for your function.
You can also automate this entire process with the help of the Lambda Power Tuning tool. This tool will help you to visualise and fine-tune the memory configuration of your Lambda function.
When you have configured the right amount of memory for your Lambda function, you can mark this rule violation for this function as resolved in the KloudMate Insights dashboard.