Skip to main content
idle · aws

Lambda functions with almost no invocations

resource types
1
rule IDs covered
1
severity
medium

What does ZopNight detect here?

A Lambda function invoked fewer than once a day over 30 days is effectively unused. Lambda bills per invocation, so the function itself costs nothing. Provisioned concurrency does, and that is usually where the recoverable cost sits on an idle function.

Signal and threshold

How ZopNight evaluates Lambda functions with almost no invocations.
Field Value
Rule IDsRC-010
Categoryidle
Severitymedium
Metricnone — pure configuration read
Sourceidle_lambda.go

Lambda is free when idle, with one exception

Lambda charges per request and per GB-second of execution. A function nobody calls generates neither, so an idle function is genuinely free to keep.

The exception is provisioned concurrency. That reserves warm execution environments and bills hourly whether or not anything invokes the function, the same shape of cost as an idle NAT Gateway. An idle function with provisioned concurrency configured is paying for readiness nobody uses, and that is the real finding here.

The threshold

Below one invocation per day, averaged over 30 days of the Invocations count Lambda reports to CloudWatch. That is deliberately not zero: a function invoked by a weekly job or a rarely-hit error path is used, just infrequently, and a hard zero-test would leave it out while catching nothing extra.

What else it usually points at

An unused function often comes with things that are not free:

  • Provisioned concurrency, as above
  • An EventBridge rule or SQS trigger still active and pointed at it
  • A CloudWatch log group with no retention policy, keeping every log line since creation
  • An IAM execution role with whatever permissions the function once needed

The log group is the one that quietly accumulates. Functions get deleted; their log groups usually do not.

Summing Invocations for the function

Terminal window
aws cloudwatch get-metric-statistics \
--namespace AWS/Lambda --metric-name Invocations \
--dimensions Name=FunctionName,Value=my-function \
--start-time "$(date -u -v-30d +%Y-%m-%dT%H:%M:%SZ)" \
--end-time "$(date -u +%Y-%m-%dT%H:%M:%SZ)" \
--period 86400 --statistics Sum

Before deleting

Archive the code to S3 first. aws lambda get-function returns a download URL for the deployment package. Then remove provisioned concurrency, detach the triggers, and delete the function, its log group and its role.

See it fire on your bill.

Connect an account read-only. The first findings land in minutes.

417 rule families across 353 resource types on 22 platforms. Every threshold, metric, and IAM action is documented on these pages before you grant anything.

417 rule families documented
353 resource types covered
read-only default access level
Multi-cloud automation· Production-ready in 30 min· SOC 2 · ISO 27001· 20–60% off the bill, first month· 4 platforms · 1 console· Multi-cloud automation· Production-ready in 30 min· SOC 2 · ISO 27001· 20–60% off the bill, first month· 4 platforms · 1 console·