Skip to main content

AWS Lambda

AWS Lambda is a serverless compute service that runs code in response to events without provisioning or managing servers. You pay only for the compute time consumed - there's no charge when code isn't running.

Key Features

  • Event-driven: Triggered by AWS services, HTTP requests, or schedules
  • Auto-scaling: Scales from zero to thousands of concurrent executions
  • Pay-per-use: Billed per 1ms of execution time
  • Multiple runtimes: Node.js, Python, Java, Go, .NET, Ruby, and custom runtimes

Common Triggers

TriggerUse Case
API GatewayREST/HTTP APIs
S3File processing
DynamoDB StreamsDatabase change events
SQSMessage processing
EventBridgeScheduled tasks, event routing
CognitoAuthentication triggers

Function Configuration

// handler.js
exports.handler = async (event) => {
const name = event.queryStringParameters?.name || 'World';
return {
statusCode: 200,
body: JSON.stringify({ message: `Hello, ${name}!` }),
};
};

Limits and Quotas

ResourceLimit
Timeout15 minutes
Memory128 MB - 10 GB
Deployment package50 MB (zipped), 250 MB (unzipped)
Concurrent executions1,000 (soft limit)
/tmp storage512 MB - 10 GB

What We Like

  • Zero infrastructure: No servers to manage, patch, or scale
  • Cost efficient: Only pay for actual execution time
  • Fast deployment: Push code and it's live
  • Tight AWS integration: First-class support throughout AWS

What We Don't Like

  • Cold starts: First invocation after idle can be slow
  • Stateless: No persistent connections or in-memory state
  • Debugging: Local development doesn't perfectly match production
  • Vendor lock-in: Lambda-specific patterns can be hard to migrate

Cold Start Mitigation

  • Use Provisioned Concurrency for latency-sensitive workloads
  • Keep functions warm with scheduled pings
  • Choose runtimes wisely (Node.js and Python start faster than Java)
  • Minimise deployment package size