📡 You're offline — showing cached content
New version available!
Quick Access
Tutorials AWS Solutions Architect Lambda — Serverless Compute

Lambda — Serverless Compute

5 min read Quiz at the end
Understand Lambda event triggers, cold starts, concurrency, and when serverless is the right architectural choice.

Lambda — Run Code Without Servers

Lambda runs your code in response to events without you managing any servers. You upload your code, define what triggers it, and Lambda handles everything else — scaling, patching, infrastructure.

Teacher Note: Traditional servers are like owning a car — you pay for it 24/7 even when it sits in the garage unused. Lambda is like Uber — you only pay for the exact trips you take. For a function that runs 1,000 times per day for 200ms each, you pay for 200 SECONDS of compute — not 24 hours.

How Lambda Works

Trigger --> Lambda Function --> Response

Example Triggers:
S3 file uploaded   --> Process image, generate thumbnail
API Gateway call   --> Handle HTTP request, return JSON
DynamoDB change    --> Update search index in OpenSearch
EventBridge rule   --> Send daily report email at 9am
SNS message        --> Send push notification to mobile app
SQS message        --> Process order from queue

Lambda Configuration

SettingRangeImpact
Memory128MB to 10,240MBCPU scales proportionally with memory
Timeout1 second to 15 minutesMaximum function execution time
Concurrency0 to thousandsMax simultaneous executions
Deployment package50MB zip / 10GB container imageCode + dependencies size limit

Cold Starts

A cold start happens when Lambda creates a NEW execution environment — it must download your code and initialise the runtime before executing. This adds latency (100ms to 5 seconds depending on runtime).

MitigationHowWhen to Use
Provisioned ConcurrencyPre-warm N containers — always readyLatency-sensitive production APIs
Smaller packageLess to download and initialiseAlways — keep dependencies minimal
Choose Python/Node.jsFaster cold start than JavaWhen cold starts matter
SnapStart (Java)Snapshot initialised JVM — restore instead of initJava Lambda with cold start issues
Exam Tip: Lambda pricing is PER REQUEST + PER DURATION. 1 million requests/month is FREE. After that: $0.20 per million. 400,000 GB-seconds/month is FREE. For low-traffic applications, Lambda is often FREE or costs pennies per month.
Topic Quiz · 2 questions

Test your understanding before moving on

1. A Lambda function processes S3 file uploads. Traffic is low but the application is latency-sensitive. Cold starts are adding 3 seconds of delay. What is the BEST solution?
💡 Provisioned Concurrency pre-initialises a specified number of Lambda containers so they are always ready — eliminating cold start latency.
2. What is the maximum execution timeout for an AWS Lambda function?
💡 Lambda has a maximum timeout of 15 minutes (900 seconds). For longer workloads, use Step Functions with ECS tasks or EC2.