Serverless Architecture
Run code without provisioning infrastructure. Scale to zero. Pay only for what executes.
Overview
Serverless means the cloud provider manages all infrastructure. You write functions, define triggers, and the platform handles scaling, patching, and availability. Scale to zero when idle — no traffic, no cost.
Core Components
API Gateway
Managed HTTP/WebSocket endpoint. Routes requests to Lambda. Handles auth, throttling, and caching.
Lambda
Runs your code in response to events. 15 min max. Supports Python, Node, Java, Go, and more.
DynamoDB
Serverless NoSQL. On-demand capacity — no provisioning. Scales with Lambda automatically.
EventBridge
Event bus for decoupled serverless workflows. Schedule events, route by pattern, fan-out.
Step Functions
Orchestrate Lambda functions into workflows. Visual state machines. Built-in retries and error handling.
Cognito
Managed auth — user pools, JWT tokens, social login. No auth server to run.
When Serverless Wins
- Unpredictable traffic — spiky or bursty workloads where you'd over-provision EC2
- Event-driven processing — file uploads, DB changes, queue messages
- Low operational overhead — no patching, no AMIs, no capacity planning
- Cost optimization — true pay-per-use, no idle cost
Watch Out For
- Cold starts — first invocation after idle can be slow (use provisioned concurrency)
- 15 min time limit — not suitable for long-running jobs (use ECS or Batch)
- Vendor lock-in — tightly coupled to AWS event model
- Debugging complexity — distributed tracing with X-Ray is essential
References
AWS Serverless Workshops
Hands-on workshops covering Lambda, API Gateway, DynamoDB, and more
GitHubTerraform Lambda Module
Production-ready Lambda function configuration with IAM, VPC, and monitoring
GitHubWell-Architected Serverless Lens
Five-pillar guidance specifically for serverless workloads
AWS Docs