Skip to main content
In this lesson we cover high availability and resiliency patterns for AWS Lambda and serverless architectures. AWS Lambda is a serverless, event-driven compute service that runs code in response to triggers. A common pattern is an S3 upload triggering a Lambda function to process a file and write the result to another S3 bucket—useful for media processing, thumbnails, and transcription pipelines.
A simple AWS event-driven workflow diagram. A file uploaded to an Input S3 bucket triggers a Lambda function, which writes the result to an Output S3 bucket.
API Gateway is a typical “front door” for Lambda functions. It provides request validation, rate limiting, caching, throttling, and basic transformation—acting like an abstraction layer (similar to a load balancer) to protect downstream services and shape traffic for better resiliency. Lambda also integrates naturally with monitoring and alerting workflows. CloudWatch alarms, EventBridge rules, or SNS topics can invoke Lambda functions for automated remediation, notifications, or to kick off additional workflows.
A slide titled "Lambda – Monitoring and Alerting Workflow" showing Amazon CloudWatch on the left feeding into an AWS Lambda function in the center, which then sends to Amazon SNS on the right. Arrows indicate the left-to-right flow of monitoring events and alerts.
Key Lambda characteristics
  • Serverless and event-driven model with pay-per-use billing.
  • Supports many runtimes and custom runtimes.
  • Automatic scaling within service quotas.
  • Built-in retry and failure handling semantics (behavior depends on invocation type).
A presentation slide titled "Features" showing five numbered cards with colorful icons and labels: Serverless, Event-driven, Language Support, Fault Tolerance, and Automatic Scaling.
Versioning and traffic shifting
  • Publish versions of functions and create aliases (for example, an alias named checkout-prod) to manage production traffic.
  • Use weighted traffic shifting to perform blue/green or canary deployments (for example, 90% to V1 and 10% to V2). Monitor error rates and latency during the shift.
  • If issues occur, point the alias back to the stable version for an immediate rollback without redeploying.
A diagram showing how AWS Lambda versioning and aliases route traffic: a checkout-prod alias sends 90% of requests to version V1 and 10% to V2. The left side shows a Lambda function with labeled versions used for cart validation, payment processing, and order confirmation.
Decoupling and asynchronous processing
  • Decouple producers and consumers with Amazon SQS, Amazon SNS, or EventBridge to improve resiliency and failure isolation.
  • Example flow: seller uploads images to S3 → event enqueues a message to SQS → Lambda polls SQS and processes images (resize, watermark) → writes optimized images to output storage. This lets uploads return quickly and offloads heavy processing to asynchronous consumers.
An architecture diagram titled "Asynchronous Invocation" showing sellers upload product images to an S3 bucket, which enqueues a job in SQS and triggers a Lambda function. The Lambda resizes images, adds watermarks, and saves optimized versions.
Retries and dead-letter queues (DLQs) Below is a concise summary of retry behavior by invocation type and recommended handling. DLQs are critical for capturing failed payloads for investigation and replay. For SQS-based flows, use the queue’s Dead-Letter Queue configuration. For asynchronous Lambda invocations, configure destinations or an SNS/SQS DLQ.
Important: retry semantics differ by invocation type—verify whether your trigger is synchronous, asynchronous, or an event-source mapping (for example, Amazon SQS/Amazon Kinesis/DynamoDB Streams) and design dead-letter handling accordingly.
Scaling, cold starts, and Provisioned Concurrency
  • Lambda scales by creating additional execution environments (containers) as concurrent requests increase.
  • Default regional concurrency quota is 1,000 concurrent executions per region (request increases as needed). Use reserved concurrency to guarantee capacity or to cap a function’s concurrency to protect downstream services.
  • Cold starts occur when Lambda initializes a new execution environment: downloading code, starting the container, initializing the runtime, and running init code. Cold starts add latency to the first invocation on a new environment.
  • Use Provisioned Concurrency to keep execution environments initialized and reduce cold-start latency.
A timeline diagram illustrating Lambda function scaling: numbered requests show "Init" (cold start) and "Invoke" bars across time with vertical markers and a concurrent requests scale. It visualizes how new function instances are initialized and invoked as load increases.
Practical mitigations:
  • Pre-warm functions with scheduled invocations for predictable short bursts.
  • Configure Provisioned Concurrency per alias or version to keep a known number of warm instances for latency-sensitive workloads.
A diagram titled "Cold Start" showing a trigger icon → AWS Lambda icon → a panel labeled "Lambda Cold Period" that lists the steps: download the code, start a new container, load Lambda into runtime, and execute the function.
A slide diagram titled "Mitigation with Provisioned Concurrency" showing a trigger icon pointing to an AWS Lambda icon, then to a "Warm Instance" box and finally to a Lambda function-invoked icon.
Networking, VPCs, and ENIs
  • Place Lambdas in a VPC when they need to access resources in private subnets (RDS, ElastiCache, etc.). When a Lambda requires VPC access, Lambda creates Elastic Network Interfaces (ENIs) in your chosen subnets.
  • For high availability and capacity, provide private subnets in multiple Availability Zones (ideally one subnet per AZ). Lambda will distribute ENIs and execution environments across those subnets to help maintain availability during AZ issues.
A diagram of an AWS VPC showing a Lambda function in a private subnet connecting through an Elastic Network Interface to an Amazon RDS instance in another private subnet. The title reads "Lambda inside a VPC."
Regional redundancy and Availability Zone behavior
  • Lambda is a regional service and its control plane and execution environments are designed for high availability across multiple AZs.
  • You do not need to replicate functions manually across AZs; instead, ensure your VPC configuration (subnets, route tables, NAT/Egress) supports cross-AZ operation and scaling so Lambda can place ENIs and execution environments across AZs.
A diagram titled "Scaling with High Availability in VPC" showing an AWS Cloud with three Availability Zones, each hosting Lambda service instances. An AZ health check at the bottom marks zones healthy or unhealthy while customers connect from above.
Best practices summary
  • Use versioning and aliases for safe rollouts and fast rollbacks.
  • Decouple components with SQS/SNS/EventBridge for resiliency and asynchronous processing.
  • Understand retry semantics and add DLQs or destinations where appropriate.
  • Plan concurrency and consider Provisioned Concurrency for latency-sensitive workloads.
  • When using VPC access, provide multiple private subnets across AZs and verify NAT and routing to support scaling.
Table — Common concerns and mitigations Links and references That concludes the core concepts for Lambda and serverless resiliency covered in this lesson.

Watch Video