Start a conversation

Optimize Lambda Memory Allocation

Opportunity Name:

Optimize Lambda Memory Allocation

 

AWS Resource Type:

AWS Lambda

 

Opportunity Description:

AWS Lambda functions often have memory allocated beyond their actual usage needs, leading to unnecessary costs. CloudFix identifies these functions and recommends optimized memory settings based on actual usage patterns, potentially reducing costs without impacting performance.

 

Criteria for identifying the opportunity:

  • Analyzes Lambda functions with memory allocation metrics available for the last 30 days (configurable).
  • Flags a function when its peak used memory, plus a configurable overhead allowance (default 10%), is still below the allocated memory—not simply "uses under 10% of allocated memory." A function using, for example, 80% of its allocated memory can still be flagged if peak usage plus the allowance leaves room to size down.
  • The recommended memory size is the peak usage plus the overhead allowance, subject to the AWS Lambda minimum memory size.
  • Annual cost, extrapolated from the last 30 days of usage, exceeds the annual public cost threshold (default $100).

 

Can CloudFix implement the fix automatically once I accept the recommendation?

Yes. Once you approve the recommendation, CloudFix runs an SSM Automation runbook that calls lambda:UpdateFunctionConfiguration to apply the new memory size, then tags the function to record the fixer ID and execution date.

 

Other considerations:

  • Performance impact: Reducing a Lambda function's memory also reduces its allocated CPU, since AWS Lambda scales CPU proportionally with memory. When CloudWatch Lambda Insights data is available, CloudFix runs a CPU-impact analysis and estimates how much a smaller memory size would slow down CPU-bound invocations; if the resulting savings realization would fall below a configurable threshold (default 50%), the recommendation is rejected rather than risking a net-negative change.
  • Data loss considerations: There is no risk of data loss when adjusting Lambda memory settings.
  • Security concerns: Memory optimization does not impact the security posture of your Lambda functions.

 

Additional Resources:

Choose files or drag and drop files
Was this article helpful?
Yes
No
  1. Priyanka Bhotika

  2. Posted
  3. Updated

Comments