AWS Lambda

Learn how AWS Lambda runs event-driven code without server management and how cold starts, limits, and pricing affect serverless design.

AWS Lambda is a serverless compute service that runs code in response to events. Instead of provisioning servers, you upload a function, define a runtime, attach permissions, and connect the function to triggers such as S3 uploads, API Gateway requests, EventBridge schedules, or SQS messages. AWS handles the underlying execution environment and charges mostly for request count and execution duration.

Lambda: Event-Driven Execution

Event Source
S3 / API GW / SQS…
triggers
Lambda Function
your code
can call
AWS Services
DynamoDB, S3, SNS…
Execution Role (IAM)
grants permissions to Lambda

Lambda scales to zero — you pay only for the milliseconds your code actually runs

Lambda fits event-driven architecture especially well. A file lands in S3, a function resizes an image. A message enters a queue, a function processes it. An HTTP request reaches an API, a function returns JSON. This model reduces idle infrastructure, but it also changes design decisions: functions should be small, stateless, and comfortable with retries and short execution windows.

Constraint or behaviorWhy it matters
Cold startsFirst request after inactivity may be slower while the runtime initializes
Timeout limitLong-running work must be split or moved to another service
Memory settingControls both RAM and available CPU, which affects speed and cost
ConcurrencyBursts can scale rapidly, but limits still need monitoring

Cold starts matter most for latency-sensitive APIs. They are less important for asynchronous jobs where a few hundred milliseconds do not affect user experience. Packaging size, VPC networking, runtime choice, and dependency loading all influence how noticeable the startup delay becomes.

Lambda can be extremely cost-effective for spiky or low-traffic workloads because you are not paying to keep servers idle. For steady high-throughput systems, containers or EC2 may be cheaper and easier to tune. The goal is not to replace every server with a function; it is to use Lambda where event-driven scaling and low operational overhead actually improve the system.

Continue with AWS Lambda Functions for a hands-on example.

aws lambda list-functions --query 'Functions[].FunctionName' --output table
aws lambda get-account-settings

Operational note

Serverless systems benefit from the same engineering discipline as any other runtime. Keep functions small, log useful context, define retries deliberately, and measure duration and error patterns in CloudWatch. Those practices matter more than the runtime language because they determine whether a Lambda workload stays easy to operate at scale. Shared standards like this make future environments easier to launch, review, and support.

Exercise

Lambda model

What best describes AWS Lambda?

Exercise

Cold starts

What is a Lambda cold start?

Continue Learning

Explore Related Topics

Related Resources