Skip to main content

What is AWS Lambda?

Understand how AWS Lambda runs code, how functions are invoked, where permissions and state live, and when Lambda is a good compute choice.

What is AWS Lambda?

AWS Lambda is a managed compute service that runs code in response to an invocation or event without requiring you to provision or manage servers. You deploy function code and configuration; Lambda manages the execution environment and scales function capacity with demand.

How this topic fits

Compute

Understand Lambda execution, scaling, concurrency, packaging, event sources, cold starts, and when serverless containers are the better fit.

The Lambda function model

A Lambda function combines code with configuration. The code exposes a handler that receives an event and invocation context. The configuration defines details such as the runtime, memory, timeout, environment variables, networking, concurrency controls, and an IAM execution role.

Functions can be invoked directly or connected to event sources. HTTP requests, object changes, queue messages, stream records, schedules, and events from other AWS services can all initiate work through different integration models.

The entry point that validates the event, performs one bounded responsibility, and returns or records an outcome.

The IAM role that defines which AWS actions and resources the function is allowed to access.

The request, message, stream, schedule, or service event that causes the function to run.

What happens during an invocation

Lambda receives an invocation, selects or creates an execution environment, initializes the runtime and your code when needed, and calls the handler. An available environment may be reused for later invocations, so initialization work can be reused but must never be treated as durable application state.

The caller and integration determine how success, errors, retries, and duplicate delivery behave. A synchronous API request and a batch of queue messages have different failure contracts. Design the function around the contract of its event source rather than treating every invocation the same.

When Lambda is a good fit

Lambda is a strong option for event handlers, APIs, automation, file processing, stream or queue consumers, scheduled jobs, and workflow tasks that fit its execution model. It works especially well when demand varies and each unit of work has a clear input, output, and ownership boundary.

A function should not become the default answer to every compute problem. Review execution duration, concurrency behavior, startup sensitivity, networking, package size, local tooling, data gravity, and cost shape before choosing the service.

A production Lambda checklist

Treat retries and duplicate events as normal. Make handlers idempotent where the integration can redeliver work, validate every event at the boundary, and record enough context to trace one business operation across services.

Grant the execution role only the actions and resources the function needs. Set explicit timeouts and concurrency controls, define failure destinations or dead-letter handling where appropriate, protect secrets, and alarm on user-visible failure rather than invocation count alone.

Define retry, timeout, partial failure, duplicate delivery, and recovery behavior for the actual event source.

Use least-privilege execution roles, narrow resource policies, validated inputs, encrypted data, and controlled secrets.

Capture structured logs, useful metrics, traces, cost signals, and alarms that connect technical symptoms to customer impact.

Go deeper with AWS

Read the primary AWS documentation behind the service definitions and architecture guidance in this guide.

Explore serverless products

Questions about this topic

Browse all serverless concepts

Explore compute, APIs, events, workflows, data, security, reliability, operations, delivery, and AI from one connected AWS serverless learning path.

What is serverless?

Learn what serverless computing means, how it works on AWS, what the cloud provider manages, and which trade-offs still belong to your team.

Read the guide

What is AWS Lambda?

Understand how AWS Lambda runs code, how functions are invoked, where permissions and state live, and when Lambda is a good compute choice.

Read the guide

What is serverless architecture?

Learn how managed compute, APIs, events, queues, workflows, data, identity, and observability fit together in a serverless architecture on AWS.

Read the guide

AWS serverless security

A practical guide to identity, least privilege, event validation, secrets, data protection, dependencies, and incident visibility in AWS serverless systems.

Read the guide

What is agentic AI?

Learn what makes an AI system agentic, how models, tools, memory, orchestration, identity, and evaluation fit together, and where serverless patterns help on AWS.

Read the guide

What is cloud computing?

Understand how on-demand infrastructure and managed services change the way teams provision, scale, pay for, and operate software systems.

Read the guide

What is event-driven architecture?

Learn how producers, routers, and consumers communicate through events, and how to design schemas, delivery, retries, and ownership deliberately.

Read the guide

What is a serverless API?

Understand the request path, authentication, routing, compute, data, throttling, observability, and failure controls behind a serverless API on AWS.

Read the guide

What are serverless workflows?

Learn when explicit workflow state improves retries, branching, parallel work, human approval, visibility, and recovery in distributed applications.

Read the guide

What is Amazon API Gateway?

Learn how API Gateway creates, publishes, secures, monitors, and operates HTTP, REST, and WebSocket APIs for AWS and external backends.

Read the guide

What is Amazon EventBridge?

Understand EventBridge event buses, rules, pipes, schemas, targets, schedules, permissions, delivery, and recovery in event-driven AWS systems.

Read the guide

Make the next serverless decision explicit.

Explore focused products for repeatable work, or bring the architecture decision that needs context and experienced review.