← All Cheatsheets
Cloud
Runtimes · Triggers · Limits · Cold Starts · IAM · Observability · Best Practices
Function
Unit of deployment. Code + config + IAM role. Stateless by design.
Handler
Entry point. exports.handler = async (event, context) => {}
Event
JSON payload from the trigger (API GW, SQS, S3, etc.)
Context
Runtime info: requestId, remainingTime, functionName, memoryLimit.
Execution environment
Isolated micro-VM. Reused across warm invocations (init code runs once).
From S3 or ECR. Larger packages = slower.
Micro-VM init. JVM/Node/.NET differ significantly.
Code outside handler: DB connections, SDK clients.
Your actual function logic.
Mitigation Strategies
Execution Role
IAM role Lambda assumes at runtime. Grants access to AWS services (DynamoDB, S3, etc.). Principle of least privilege.
Resource Policy
Controls who can invoke the function. Required for cross-account or service triggers (S3, SNS).
# Minimum execution role
AWSLambdaBasicExecutionRole
# + VPC access
AWSLambdaVPCAccessExecutionRole
| Runtime | Cold Start | Best for |
|---|---|---|
| Node.js 20.x | ~100ms | APIs, event processing, general |
| Python 3.12 | ~100ms | ML, data, scripting |
| Java 21 | ~500ms+ | Enterprise, SnapStart |
| .NET 8 | ~200ms | Windows workloads |
| Go 1.x | ~50ms | High-perf, low latency |
| Container | Varies | Custom deps, large packages |
CloudWatch Logs
Auto-created log group: /aws/lambda/function-name. Every invocation logged.
Key Metrics