Skip to main content
Lambda bills each invocation by its configured memory and duration. AWS Compute Optimizer looks at how much memory a function actually uses and how long it runs, and recommends a memory size that costs less without slowing the function down much. nOps imports these recommendations daily through AWS Cost Optimization Hub and shows the estimated monthly saving.

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

  1. Review the recommended memory size and the projected duration.
  2. Test the function at the new memory size, ideally on a test alias or version, and check duration and errors.
  3. Change it: Lambda → Functions → Configuration → General configuration → Edit → Memory, or aws lambda update-function-configuration --function-name NAME --memory-size MB.
  4. 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

Compute Optimizer only analyzes functions with enough invocations in its lookback period.