Back to Compute

AWS Lambda

aws

Run code without thinking about servers or clusters. Serverless, event-driven compute scaling from zero to tens of thousands of instances in milliseconds.

COMPUTE
Amazon Web Services

Run code without thinking about servers or clusters. Serverless, event-driven compute scaling from zero to tens of thousands of instances in milliseconds.

Click any section above to jump directly to it
GCP ➔ AWS Bridge
Fast-Track Mental Model Translation

Coming from Google Cloud?

Compare with Google Cloud Run / Cloud Functions

Both are serverless compute platforms running code on demand with automatic scale-to-zero and millisecond billing, but Lambda focuses heavily on event-driven cloud integrations while Cloud Run standardizes on HTTP containers.

What's Conceptually Identical
  • Scale-to-zero with per-millisecond execution billing.
  • Automatic elastic scaling from zero to thousands of concurrent instances.
  • Support for standard language runtimes (Python, Node.js, Go, Java) and OCI container images.
Key Architectural Shifts in AWS
  • Execution Limits: AWS Lambda has a strict 15-minute maximum execution timeout; Cloud Run supports up to 60-minute execution timeouts.
  • Concurrency per Instance: Lambda handles exactly 1 concurrent request per microVM sandbox; Cloud Run handles up to 1,000 concurrent requests per container instance.
  • Ecosystem Breadth: Lambda integrates natively with over 200 AWS event sources, EventBridge pipes, and Step Functions state machines.

What is AWS Lambda?

AWS Lambda is a serverless compute service that lets you run code without provisioning or managing servers. Lambda executes your code only when needed and scales automatically, from a few requests per day to hundreds of thousands per second. You pay strictly for the compute time you consume—there is zero charge when your code is not running.

Decision Guide: When to Choose This Service

When to Use AWS Lambda

Use AWS Lambda for event-driven processing (S3 file uploads, DynamoDB streams, Kinesis telemetry), REST/GraphQL APIs with API Gateway, scheduled cron tasks with EventBridge, and asynchronous integration queues where zero-idle server billing is desired.

When NOT to Use (Recommended Alternatives)

Do NOT use AWS Lambda for long-running processes exceeding 15 minutes (use AWS Fargate, ECS, or EC2 instead) or ultra-consistent sub-millisecond memory cache servers (use Redis/ElastiCache).

Core Architectural Pillars

Execution Environment Lifecycle

Init phase (static globals), Invoke phase (handler execution), and microVM freeze.

Concurrency Models

Reserved Concurrency (guaranteed caps protecting downstream databases) and Provisioned Concurrency (zero cold starts).

Single-Slider Resource Model

Adjusting memory (128 MB to 10,240 MB) proportionally scales dedicated CPU cores and network throughput.

Invocation Types

Synchronous (API Gateway request-response), Asynchronous (S3/SNS fire-and-forget with DLQ), and Event Source Mapping (Kinesis/SQS polling).