Back to blog
Published
2026-11-06
Reading time
6 min
Tags
FinOps
AWS
Lambda
Kubernetes
KEDA
Serverless
CostOptimization

Lambda or Kubernetes with KEDA: where the break-even point is

Sooner or later every architecture review asks the same question: do we deploy this as a Lambda function or as a container on the cluster? The discussion usually turns to cold starts and operational habits, but in the end the bill tends to decide. And the bill is simpler than it looks.

The key number

Both models charge for compute, but in different units:

  • Lambda charges per request and per GB-second, but only while the code is running.
  • Kubernetes charges per node-hour, whether the pods are doing anything or not.

Unit prices (eu-west-1, x86, rounded):

Unit Lambda EC2 node
1 GB for 1 second $0.0000167 $0.0000037
1 GB for 1 hour $0.06 $0.0134
1 GB for a whole month (24/7) ~$44 ~$9.8

The node is an m6i.large ($0.107/h for 8 GB), the same one we used in the kube-green guide. On ARM (Graviton) both sides are about 20% cheaper and the ratio stays the same.

A GB-second on Lambda costs about 4.5 times as much as on a fully used node. Kubernetes is much cheaper per unit of compute; Lambda's advantage is that it charges nothing when idle. So the real question is: what fraction of the time is the service actually busy?

Where the break-even is

If the container runs 24/7 (a regular Deployment, no autoscaling), the break-even utilization is:

$0.0134 / $0.06 ≈ 22%

A service that is up all day but busy less than ~20% of the time is cheaper on Lambda. Once you account for system pods, headroom and HA replicas, the cluster becomes cheaper from about 30% utilization.

But comparing against a container that runs 24/7 is not fair, and this is where KEDA comes in. KEDA is an event-driven autoscaler for Kubernetes: it watches a source (an SQS queue, a Kafka topic, a Prometheus metric, a schedule) and scales a Deployment between 0 and N replicas. When the queue is empty there are no pods; when messages arrive, it starts them.

With scale to zero, pods only run when there is work, which is Lambda's billing model at a much lower unit price. What remains of the Kubernetes bill is the fixed cost of the cluster:

Minimum dedicated cluster ~$/month
EKS control plane ($0.10/h) 73
One always-on node (m6i.large) 78
One ALB ~17
Total ~170

Each busy GB-hour moved from Lambda to the cluster saves about $0.04 (Lambda's $0.06 minus the node cost, overhead included). A dedicated cluster therefore pays for itself from about 4,500 busy GB-hours a month: on average 6 GB busy at any moment, for example ten 2 GB workers busy a third of the time. If the cluster already exists for other workloads, its fixed cost is already paid and Kubernetes wins almost always, except for very small workloads that fit in Lambda's free tier (1 million requests and 400,000 GB-seconds a month).

An example ScaledObject

apiVersion: keda.sh/v1alpha1
kind: ScaledObject
metadata:
  name: worker
  namespace: jobs
spec:
  scaleTargetRef:
    name: worker
  minReplicaCount: 0
  maxReplicaCount: 20
  cooldownPeriod: 300          # 5 min without messages before scaling to 0
  triggers:
    - type: aws-sqs-queue
      metadata:
        queueURL: https://sqs.eu-west-1.amazonaws.com/123456789012/jobs
        awsRegion: eu-west-1
        queueLength: "5"       # one replica per 5 pending messages

KEDA also needs permission to read the queue, through pod identity or a TriggerAuthentication.

For HTTP services there is the HTTP add-on, which puts a proxy in front of the service and scales on request rate. It works, but it adds one more component, so most teams keep HTTP services at minReplicaCount: 1 and use scale to zero for queue-driven work, where it fits best.

Three scenarios, with numbers

Workloads with 1 GB of memory, on x86, with the free tier already used up. The Kubernetes cost assumes pods run 1.3-1.5 times longer than the actual busy time (startup, cooldown, imperfect packing on nodes).

Scenario Lambda K8s + KEDA, existing cluster K8s + KEDA, dedicated cluster
Batch job: 2,000 runs × 10 min ~$20 ~$6 ~$175 (almost all fixed cost)
Queue worker: 20M messages × 500 ms ~$170 ~$50 ~$220
Steady service: 100M requests × 400 ms ~$690 ~$210 ~$380
  • Small, occasional jobs: the amounts are small either way; choose whatever is easier to operate.
  • Medium volume: an existing cluster is about 3 times cheaper; a cluster built just for this costs more than Lambda.
  • Steady load: Kubernetes wins even when it pays for its own cluster (~$380 against ~$690), and on an existing cluster it is more than 3 times cheaper.

The Lambda figure for the third row: 100M × 0.4 s = 11,111 GB-hours × $0.06 = $667, plus 100M requests × $0.20 per million = $20. On the cluster, the same 11,111 GB-hours cost ~$150 at node prices, and ~$210 with the overhead.

What the table does not show

On the Lambda side

  • API Gateway in front of an HTTP function costs $1 (HTTP API) to $3.50 (REST API) per million requests, often more than the compute itself. A Function URL has no extra cost.
  • CloudWatch Logs charges ~$0.57 per GB ingested in eu-west-1: a function that logs a lot can spend more on logs than on compute.
  • Provisioned concurrency, used to avoid cold starts, is billed 24/7 whether it is used or not, which brings back the idle cost Lambda was supposed to avoid.
  • Hard limits: 15 minutes per invocation and 10 GB of memory. Long-lived connections such as WebSockets need API Gateway, which bills per message and per connection minute.
  • In exchange, Lambda absorbs sudden peaks immediately, with no capacity planning.

On the Kubernetes side

  • EKS extended support: if you fall behind on versions, the control plane goes from $0.10/h to $0.60/h, $438 a month.
  • Scaling from zero is not instant: pulling the image and starting the pod takes 10-60 s, more if a new node is needed. That is fine for queues; for user-facing traffic, keep at least one replica running.
  • DaemonSets and monitoring agents take up part of every node.
  • Oversized memory requests (above actual usage) waste capacity, just like configuring a 3 GB Lambda for a workload that needs 512 MB.
  • HA replicas double the cost of anything that has to survive losing a node.

Factors other than cost: jobs longer than 15 minutes or needing more than 10 GB, GPUs, long-lived connections or local state point to Kubernetes. Zero operations, event fan-out and instant response to unpredictable peaks point to Lambda. And portability: a Lambda function is tied to AWS, while the same container image runs on EKS, GKE, AKS or on-premises.

Summary

  1. Per unit of compute, Lambda costs about 4.5 times as much as a node. Its advantage is that you pay nothing while it is idle.
  2. KEDA scales queue-driven work down to zero, which removes most of that idle cost. The comparison becomes busy GB-hours against the fixed cost of the cluster.
  3. If the cluster already exists, Kubernetes wins almost always, except for very small workloads within the free tier.
  4. If you need a cluster just for this, it pays off from about 4,500 busy GB-hours a month; below that, Lambda is cheaper.
  5. Close to the break-even point, decide on cold starts, limits and portability; far from it, price decides.

Measure your real busy GB-hours from the bill or your metrics rather than estimating them: the comparison is only as good as the numbers you put in.

Find this waste automatically

PruneOps audits your cloud accounts and tells you what to fix first.

Get started Read the docs