7.1 Serverless Architecture Patterns

Key Takeaways

  • A serverless architecture combines API Gateway + Lambda + DynamoDB (or S3) to build fully managed, auto-scaling applications with zero server management.
  • The serverless stack eliminates capacity planning, patching, and infrastructure management — you pay only for what you use.
  • Common serverless patterns include: API backend (API Gateway + Lambda), event processing (S3/SQS/EventBridge → Lambda), and scheduled tasks (EventBridge → Lambda).
  • Serverless is ideal for variable workloads, microservices, and event-driven architectures but may not be cost-effective for high-volume steady-state workloads.
  • Lambda@Edge and CloudFront Functions extend serverless to the edge for low-latency request/response manipulation.
Last updated: March 2026

Serverless Architecture Patterns

Quick Answer: Serverless = no servers to manage, auto-scales, pay-per-use. Core pattern: API Gateway (HTTP) → Lambda (compute) → DynamoDB/S3 (storage). Add SQS for async processing, Step Functions for orchestration, EventBridge for event routing. Serverless is ideal for variable, event-driven workloads.

What Makes an Architecture Serverless?

CharacteristicDescription
No server managementAWS manages all infrastructure
Auto-scalingScales from zero to peak demand automatically
Pay-per-useBilled only when code runs or data is stored
Built-in HARuns across multiple AZs by default
Event-drivenFunctions triggered by events, not running continuously

AWS Serverless Services

ServiceRole in Architecture
LambdaCompute (run code in response to events)
API GatewayHTTP/REST/WebSocket API frontend
DynamoDBNoSQL database (key-value, document)
S3Object storage, static website hosting
Step FunctionsWorkflow orchestration
EventBridgeEvent bus for routing events
SQSMessage queuing for decoupling
SNSPub/sub messaging
CognitoUser authentication
AppSyncGraphQL API (real-time data sync)
Aurora ServerlessRelational database (auto-scaling)
FargateServerless containers

Common Serverless Patterns

Pattern 1: Serverless REST API

Client → API Gateway → Lambda → DynamoDB
                                → S3 (for files)

Use case: CRUD APIs, mobile backends, web applications

Pattern 2: Event-Driven Processing

S3 (file upload) → Lambda → DynamoDB (metadata)
                          → S3 (processed file)
                          → SNS (notification)

Use case: Image processing, document transformation, data validation

Pattern 3: Async Processing with Queue

API Gateway → SQS → Lambda → DynamoDB

Use case: Order processing, email sending, long-running tasks

Pattern 4: Scheduled Tasks

EventBridge (cron) → Lambda → S3/DynamoDB/SNS

Use case: Report generation, cleanup tasks, data aggregation

Pattern 5: Real-Time Streaming

IoT/Logs → Kinesis Data Streams → Lambda → DynamoDB/S3
                                 → Kinesis Data Firehose → S3/Redshift

Use case: IoT data processing, log analytics, real-time dashboards

Pattern 6: Fan-Out Processing

SNS Topic → SQS Queue 1 → Lambda (email service)
          → SQS Queue 2 → Lambda (inventory service)
          → SQS Queue 3 → Lambda (analytics service)

Use case: One event triggers multiple independent workflows

Serverless vs. Traditional

AspectServerlessEC2-Based
Ops overheadNonePatching, scaling, monitoring
ScalingAutomatic, per-requestAuto Scaling groups (manual config)
Idle costZero (Lambda)Always-on instances
Cold startsYes (seconds)No (always running)
Max duration15 min (Lambda)Unlimited
Cost at scaleCan be higherLower with Reserved pricing
Best forVariable, event-drivenSteady-state, long-running

On the Exam: "Minimize operational overhead for a new web API" → API Gateway + Lambda + DynamoDB. "The workload has unpredictable traffic from 0 to 10,000 requests/minute" → Serverless (auto-scales from zero).

Test Your Knowledge

A startup wants to build a REST API with minimal operational overhead that automatically scales to zero when not in use. Which architecture should they choose?

A
B
C
D
Test Your Knowledge

Which serverless pattern is BEST for processing each item in an order independently when an order event is published?

A
B
C
D
Test Your Knowledge

A company wants to run a cleanup job every night at midnight that deletes expired records from DynamoDB. Which serverless approach should they use?

A
B
C
D
Test Your Knowledge

What is a key advantage of serverless architectures over traditional EC2-based architectures for workloads with highly variable traffic?

A
B
C
D