Why it matters
Memory is often set high once and never revisited. For functions that run millions of times, a smaller memory setting saves money on every invocation.How nOps finds it
This recommendation comes from AWS Compute Optimizer, not from nOps. Compute Optimizer analyzes the function’s memory use and duration over its lookback period and recommends a memory size and an estimated saving. nOps imports the highest-saving recommendation AWS gives for each function.Before you start
AWS Compute Optimizer enabled for the account, and permission to update the function configuration (lambda:UpdateFunctionConfiguration).
How to implement
- Review the recommended memory size and the projected duration.
- Test the function at the new memory size, ideally on a test alias or version, and check duration and errors.
- Change it: Lambda → Functions → Configuration → General configuration → Edit → Memory, or
aws lambda update-function-configuration --function-name NAME --memory-size MB. - Update the memory in Terraform, CloudFormation or SAM so a later deployment does not change it back.
Risks and considerations
- Lambda allocates CPU in proportion to memory, so less memory can mean longer runs. Watch duration and timeouts after the change.
- Functions with spiky or seasonal input may need more memory than the lookback period showed.
- To roll back, set the memory back to its previous value.
FAQs
Why doesn't every function get a recommendation?
Why doesn't every function get a recommendation?
Compute Optimizer only analyzes functions with enough invocations in its lookback period.