1. What is AWS Lambda?

AWS Lambda is a serverless compute service that lets you run code without provisioning or managing servers. You upload your code, and Lambda handles everything needed to run and scale it with high availability. You pay only for the compute time you consume.

Core Concept Lambda = Functions as a Service (FaaS). You write a function, upload it, define a trigger, and Lambda runs it automatically when the trigger fires. No servers, no patching, no scaling decisions. You pay per request and per duration of execution.

2. Key Characteristics

  1. No servers to manage — truly serverless
  2. Automatic scaling — runs in parallel, scales with the number of requests
  3. Event-driven — triggered by AWS services or HTTP calls
  4. Short-lived — maximum execution time is 15 minutes per invocation
  5. Stateless — each invocation is independent (no shared state between invocations)
  6. Pay-per-use — billed per request and per millisecond of execution time
  7. Free tier: 1 million requests + 400,000 GB-seconds per month

3. Lambda Limits (Important for Exam)

Important Warning The 15-minute timeout is a hard limit. If your process takes longer than 15 minutes, Lambda is NOT the right service. Consider ECS Fargate, Step Functions (with multiple Lambda invocations), or EC2 instead.


4. Supported Runtimes

  1. Python, Node.js, Java, .NET (C#/PowerShell), Go, Ruby
  2. Custom Runtime API — bring any language (e.g., Rust, C++) via Custom Runtime
  3. Container Images — up to 10 GB, must implement Lambda Runtime API

5. Lambda Execution Model

Handler Function

Your Lambda function has a handler — the entry point method that Lambda calls when triggered.

# Python Example
def lambda_handler(event, context):
    # event = input data from the trigger
    # context = runtime info (function name, timeout, memory)
    name = event.get('name', 'World')
    return {
        'statusCode': 200,
        'body': f'Hello, {name}!'
    }


  1. event: JSON object containing input data from the trigger source (API Gateway request, S3 event, SQS message, etc.)
  2. context: Object with runtime information: function name, version, memory limit, remaining time, request ID.

6. Lambda Event Sources (Triggers)

Lambda can be triggered by over 200 AWS services. Here are the most common:

7. Invocation Types

8. Lambda Pricing

  1. Requests: $0.20 per 1 million requests (first 1M free/month)
  2. Duration: $0.0000166667 per GB-second (400,000 GB-seconds free/month)
  3. Duration is calculated as: (memory allocated in GB) × (execution time in seconds)
  4. Provisioned Concurrency has a separate charge (always-on cost)
Pricing Example:
Function: 512 MB memory, 200ms average, 10M requests/month

Requests: 10M × $0.20/1M = $2.00
Duration:  10M × 0.2s × 0.5 GB = 1,000,000 GB-sec
           1,000,000 × $0.0000166667 = $16.67
Total:     $18.67/month (before free tier)

9. When to use

Use Lambda when you need to run code without provisioning or managing servers — triggered by events, pay only for execution time.

Key exam triggers:

  1. "serverless"
  2. "event-driven"
  3. "run code without servers."
  4. "pay per invocation."
  5. "short-running tasks"

Common scenarios:

  1. Process S3 events (image resize, file validation on upload).
  2. API backends with API Gateway + Lambda.
  3. Real-time stream processing (Kinesis, DynamoDB Streams).
  4. Scheduled tasks (cron jobs via EventBridge).
  5. Automated responses to CloudWatch alarms or Config rule violations.


Exam Tip Lambda fundamentals: 15-minute max timeout. 10 GB max memory. 1,000 default concurrent executions. Deployment zip = 50 MB (250 unzipped), container = 10 GB. Free tier = 1M requests + 400K GB-seconds. "Process takes 30 minutes" = NOT Lambda. "No server management" = Lambda or Fargate.