Skip to main content

Lambda Function

A Lambda Function is a serverless unit of code that runs only when triggered by an event — an API call, file upload, queue message, or scheduled timer — with AWS managing all provisioning and scaling. You pay only for the milliseconds your code actually executes, and each invocation is capped at a 15-minute maximum runtime, making Lambda suited to short, event-driven workloads rather than long-running processes.

A logistics platform triggers a Lambda function on every new S3 upload of a delivery-proof photo, which resizes the image and writes metadata to DynamoDB — no server ever sits idle waiting for uploads.

Cold Starts

A cold start occurs when Lambda has to spin up a fresh execution environment before running your handler; Python and Node.js typically add 100-500ms, while Java or .NET can add several seconds. Moving expensive initialization (database connections, config loading) outside the handler function means it only runs once per cold start, not on every warm invocation.

Account-Wide Concurrency Risk

Without reserved concurrency, one high-traffic function can consume the account's entire concurrent-execution limit, starving other functions — including critical ones like payment processing.

Remember

If a job might run longer than 15 minutes, Lambda is the wrong tool — use AWS Batch or Step Functions instead.

Frequently Asked Questions

Why is Lambda's 15-minute execution limit a fundamental design constraint rather than an arbitrary cap?

Lambda's billing and scaling model — pay per millisecond of execution, provision a fresh isolated execution environment per burst of concurrency — is built around short, bursty, stateless invocations, not long-running processes. The 15-minute cap forces workloads to either fit that pattern (an API call, a queue message handler, a scheduled task) or use a different compute service (ECS Fargate, EC2, Batch) for anything longer, like video transcoding or large ETL jobs.

What's the most common performance gotcha teams hit with Lambda in production?

Cold starts — when a function hasn't been invoked recently or needs to scale beyond existing warm environments, AWS provisions a brand-new execution environment, which adds latency (worse for languages like Java or .NET, and worse still for functions inside a VPC needing an ENI). For latency-sensitive APIs, teams either use Provisioned Concurrency to keep environments warm or move consistently high-traffic, latency-critical paths off Lambda entirely.