Skip to main content

AWS Glossary

AWS Lambda

Serverless compute service that runs code in response to events without provisioning or managing servers.

Last reviewed: September 2026

Definition

AWS Lambda runs your code in response to events — HTTP requests via API Gateway or Function URLs, S3 notifications, DynamoDB Streams, SQS messages, EventBridge rules — without you managing servers. AWS handles scaling from zero to account concurrency limits, patches the runtime, and bills in millisecond increments for active compute plus per-request charges. Managed runtimes in 2026 include Node.js 22 and Python 3.13 among the supported language set; container images extend the model to custom dependencies up to 10 GB.

Two 2025-era capabilities extend Lambda beyond short-lived handlers. Lambda Durable Functions coordinate multi-step workflows with built-in state and retries for runs lasting seconds to a year without idle compute between steps — SDK support includes Python, Node.js, and .NET (GA July 2026), with Java in preview. Lambda Managed Instances run functions on EC2-backed capacity (including GPU shapes) while keeping the Lambda deployment and scaling model — useful when inference needs dedicated hardware or EC2 pricing constructs.

Invocation models matter for error handling: synchronous callers see failures immediately (API Gateway, ALB); asynchronous invocations retry twice then route to DLQ; stream/poll sources (Kinesis, DynamoDB Streams, SQS) use batching, partial batch failure, and checkpoint semantics.

When to use it

  • Event-driven glue: transform S3 uploads, react to DynamoDB changes, fan out from EventBridge, or drain SQS with automatic scale-out.
  • HTTP APIs and webhooks with unpredictable traffic where provisioning EC2 or EKS nodes ahead of demand wastes money.
  • Scheduled jobs (EventBridge Scheduler) replacing cron on a always-on box — pay only for execution time.
  • Multi-step workflows that fit Durable Functions or small Step Functions graphs without maintaining orchestration infrastructure.

When not to use it

  • Sustained high CPU for hours (video encoding, large ETL) — EC2 Spot, Batch, or Fargate usually cost less per CPU-hour.
  • Processes needing >15 minutes per invocation on classic Lambda or any synchronous invoke, without refactoring into Durable Functions, LMI async (up to 90 minutes as of 9 Sep 2026), or Step Functions segments.
  • Latency-sensitive APIs that cannot tolerate cold starts and where Provisioned Concurrency cost exceeds a small always-warm container service.

Tips

  • Initialize SDK clients and DB pool handles outside the handler; reuse across warm invocations. For RDS/Aurora, front with RDS Proxy — cold starts opening hundreds of direct connections will exhaust max_connections.
  • Run Lambda Power Tuning (open source) on production-like payloads; memory scales CPU proportionally and the cheapest configuration is rarely the default 128 MB.
  • Use SnapStart on Java and minimize deployment package size on Node/Python to shrink cold-start duration; enable Provisioned Concurrency only on routes where p99 latency is contractual.
  • For SQS triggers, enable ReportBatchItemFailures so one poison message does not fail an entire batch of ten.
  • Evaluate Managed Instances when GPU inference or large /tmp (up to 10 GB ephemeral) is required but you still want Lambda’s deployment pipeline.

Gotchas

  • Serious: Lambda in a VPC without proper subnet routing loses internet access and can stall on ENI creation — use VPC endpoints for AWS APIs and size subnets for ENI density per AZ.
  • Serious: Concurrency limits are regional defaults (1,000); a surge or recursive loop (Lambda → SNS → Lambda) can throttle the whole account — set reserved concurrency on critical functions and caps on triggers.
  • Regular: 15-minute timeout is hard on classic Lambda and all sync invokes; LMI async/ESM can run 90 minutes as of 9 Sep 2026. Long Bedrock calls or batch jobs still need chunking, async invocation, Durable Functions, or Fargate when they exceed those caps.
  • Regular: /tmp is ephemeral and shared per execution environment — do not treat it as durable cache across invocations without S3 or ElastiCache.
  • Regular: CloudWatch Logs ingestion costs often exceed Lambda compute on chatty functions — structured logging at INFO, not DEBUG, in hot paths.

Official references

Need help with this topic?

Our AWS-certified team implements, audits, and optimizes these services in production — from Bedrock RAG pipelines to multi-account landing zones.