Run AWS Lambda Functions on Kubernetes With KEDA Autoscaling

Cloud Computing
Date:November 8, 2026
Topic:
Run AWS Lambda Functions on Kubernetes With KEDA Autoscaling
⏱ 3 min read

You've built a solid Kubernetes platform on AWS EKS. Your team loves the control. But developers keep asking: "Can we just run Lambda functions here?" They want event-driven scaling without managing Knative or wrestling with cold starts on AWS Lambda proper. KEDA answers that request directly.

Why Run Lambda on Kubernetes?

AWS Lambda is convenient until it isn't. Hard timeouts (15 min), package size limits (250 MB unzipped), VPC cold-start penalties, and vendor lock-in drive teams to seek alternatives. Running Lambda-compatible functions on EKS gives you longer execution, larger artifacts, full VPC control at startup, and portability. KEDA provides the event-driven glue that makes it feel serverless.

Architecture Overview

Deploy your function code as a container image to ECR. Wrap it in a thin HTTP handler (AWS Lambda Runtime Interface Emulator or a custom shim). Deploy a Kubernetes Deployment + Service. Add a KEDA ScaledObject targeting an event source — SQS, Kafka, Kinesis, or Prometheus metrics. KEDA drives the HPA; pods scale to zero when idle.

yaml
apiVersion: keda.sh/v1alpha1
kind: ScaledObject
metadata:
  name: order-processor
  namespace: production
spec:
  scaleTargetRef:
    name: order-processor
  pollingInterval: 15
  cooldownPeriod: 300
  minReplicaCount: 0
  maxReplicaCount: 50
  triggers:
  - type: aws-sqs-queue
    metadata:
      queueURL: https://sqs.us-east-1.amazonaws.com/123456789012/orders
      awsRegion: us-east-1
      queueLength: "10"
💡
TipSet minReplicaCount: 0 for true scale-to-zero. Use cooldownPeriod to prevent thrashing after burst traffic.

Authentication Without IAM Keys

Never bake AWS credentials into pods. Use IRSA (IAM Roles for Service Accounts). Annotate the ServiceAccount with the role ARN that has SQS ReceiveMessage/DeleteMessage permissions. KEDA's AWS scalers honor IRSA automatically when the pod runs on EKS.

yaml
apiVersion: v1
kind: ServiceAccount
metadata:
  name: keda-operator
  namespace: keda
  annotations:
    eks.amazonaws.com/role-arn: arn:aws:iam::123456789012:role/KEDA-SQS-Scaler

Container Image Requirements

Your image must listen on port 8080 (configurable) and accept HTTP POST with a JSON body matching the Lambda event structure. Use the public AWS Lambda base images or build your own with the Runtime Interface Emulator (RIE) baked in. Keep the image under 1 GB for fast pulls; multi-stage builds help.

Handling Cold Starts

Kubernetes cold starts differ from Lambda. Node scheduling, image pull, and container init add latency. Mitigate with: pre-pulled images via DaemonSet, node pools with reserved capacity, and KEDA's minReplicaCount > 0 for latency-sensitive paths. For true zero-scale, accept 3-8s first-request latency.

"

KEDA turns Kubernetes into a serverless platform without the opinionated baggage of Knative.

— Platform Lead, Fintech Unicorn

Observability Hooks

Emit structured logs (JSON) to stdout. Sidecar Fluent Bit ships to CloudWatch or OpenSearch. Export Prometheus metrics: function duration, error count, queue lag. KEDA exposes scaler metrics (keda_scaler_metric_value) — alert on sustained high lag to catch scaler misconfiguration.

Cost Comparison at Scale

MetricLambda (1M invocations)KEDA on EKS (t3.medium)Notes
Compute$20.00$30.373 pods × 730h
Request$0.20$0Included
Data Transfer$0.09$0.09Same
Total$20.29$30.46EKS wins >5M invocations/mo
⚠️
WarningEKS control plane ($73/mo) and node baseline costs shift break-even. Calculate your actual traffic profile.

Deploy This Week

  1. Enable KEDA operator via Helm in the keda namespace.
  2. Create IRSA role for SQS/Kinesis access.
  3. Build and push your function image to ECR.
  4. Apply Deployment, Service, ServiceAccount, ScaledObject.
  5. Send test events; verify scale-to-zero after cooldown.

✦

You now have Lambda-style event-driven scaling on infrastructure you own. No 15-minute timeout. No 250 MB limit. No cold-start lottery inside someone else's VPC. Next step: wire a canary deployment with Argo Rollouts and let KEDA scale each version independently.

Share𝕏 Twitterin LinkedInin Whatsapp