AWS Lambda
View on GitHubAWS Lambda
AWS Lambda is a serverless compute service that runs user-provided code in response to events or direct invocations without provisioning servers. It executes short-lived, stateless functions using managed runtimes or custom runtimes. Lambda normally fits as the compute layer for event-driven architectures, API backends, and background processing within an AWS account and region.
🗂 Resource Category
Compute
🧠 Exam Memory Hook
Think: "Event-driven stateless code + no servers to manage + invoke from AWS events = AWS Lambda"
📖 Ownership
Classification: AWS Managed Service
AWS responsibilities: AWS operates and patches the underlying physical infrastructure, hypervisor, operating system, and the managed Lambda execution platform and runtimes; AWS maintains the control plane, deployment infrastructure, and service availability for Lambda functions within a region. AWS also provides integrations with other AWS services and manages the platform components that schedule and run function invocations. AWS secures the service infrastructure and isolates tenants at the platform level according to the service model.
Customer responsibilities: The customer provides, packages, and uploads function code and any application libraries or dependencies included in deployment artifacts; configures function settings such as memory, timeout, environment variables, concurrency controls, and IAM execution role permissions; and secures access to data and other AWS services by configuring IAM policies, resource policies, VPC configuration, and network security. The customer is also responsible for monitoring function performance, logging, error handling, and implementing application-level security, retries, and idempotency.
Patching responsibilities: AWS patches and maintains the physical infrastructure, hypervisor, host operating system, and the managed runtime platform that executes Lambda functions; the customer is responsible for patching and updating application code, packaged libraries, dependencies, and any operating system or runtimes included inside customer-provided container images. If functions are deployed as container images, customers update the image contents and patch included software; AWS remains responsible for the underlying managed runtime host and platform components.
🏗 Typical Architecture
💡 Top 5 Features
- Event-driven invocation model supporting many AWS event sources and direct invocation APIs.
- Automatically scales function instances in response to incoming events, subject to configured concurrency controls.
- Supports multiple runtimes and custom runtimes, and allows deployment as zip archives or container images.
- Integration with AWS Identity and Access Management for execution roles and fine-grained permissions.
- Built-in integration with Amazon CloudWatch for logs and metrics and support for AWS X-Ray for tracing.
✅ Top 5 Use Cases
- HTTP API backends where API Gateway or Application Load Balancer routes requests to functions for request processing.
- Asynchronous processing for file uploads where S3 events trigger functions to transform or validate objects.
- Scheduled tasks and cron-style jobs using EventBridge scheduled rules to run maintenance or reporting code.
- Stream processing for data from Amazon Kinesis or DynamoDB Streams to perform real-time transformations.
- Glue logic in microservices architectures for orchestration, event enrichment, or background job processing invoked by SNS or SQS.
🏗 Architecture Placement
AWS Lambda sits in the compute layer as a regional serverless runtime that executes code in response to events or direct invokes. It is commonly invoked by API Gateway, S3, EventBridge, SNS, SQS, and stream services, and typically calls data stores such as DynamoDB, Amazon RDS, or S3 for persistence. Lambda functions can be configured to access resources inside a VPC when necessary, which affects networking and cold-start behavior. Monitoring and logs are usually routed to Amazon CloudWatch and tracing to AWS X-Ray.
🎯 Commonly Used With
- Amazon API Gateway
- Amazon S3
- Amazon EventBridge
- Amazon DynamoDB
- Amazon CloudWatch
🌍 5 Real-World Examples
- Retail: Validate and generate thumbnails for images uploaded by storefront users by triggering a Lambda from an S3 upload to improve asset availability for the website.
- Financial services: Enrich and forward transaction events from Kinesis streams to downstream analytics while applying lightweight validation and anonymization logic.
- Healthcare: Run scheduled ETL tasks that extract and anonymize records from a database for batch reporting using EventBridge to trigger Lambda functions.
- Media: Transcode small media clips or generate metadata using Lambda functions invoked by file upload events to S3 to enable downstream processing pipelines.
- Logistics: Process incoming IoT telemetry events from devices via Amazon Kinesis and apply filtering and routing logic before storing in DynamoDB.
🎓 AWS Exam Clues
- Choose when code is event-driven, stateless, and you want to avoid managing servers or instance lifecycles.
- Consider cold-starts, VPC networking, and concurrency limits when low-latency and steady performance are required.
- Per-invocation billing and short-lived workloads often point to Lambda over long-running compute instances.
- When functions need persistent connections, local disk, or long-running compute, evaluate alternative compute models.
- Integration strengths include native triggers from many AWS services and tight IAM-based execution permissions.
📝 Quick Revision
AWS Lambda runs stateless, event-driven functions without server provisioning and is suitable for short-lived workloads and API backends. Key production considerations include cold-starts, concurrency configuration (reserved and provisioned concurrency), VPC networking implications, and responsibility for packaging and patching application code and dependencies.
🏷 Keywords
serverless • event-driven • stateless • cold start • provisioned concurrency • reserved concurrency • Lambda layers • execution role • AWS X-Ray • environment variables • container image support • VPC access