Stateful Serverless Application

Solving the Core Challenge: Memory in a Stateless Environment

AWS Lambda + DynamoDB + API Gateway

Live Demo

Your Visit Count

Session ID: ...

The Statefulness Solution

1

Read State

Lambda uses boto3 to retrieve the current visit count from DynamoDB using your unique session_id as the primary key.

2

Modify State

The count is incremented by one, with proper Decimal type conversion to avoid JSON serialization bugs.

3

Write State

The updated count is persisted back to DynamoDB, maintaining state across serverless invocations.

Technology Stack

AWS Lambda (Python 3.11) • Amazon DynamoDB • API Gateway • AWS SAM

Deployed via Infrastructure as Code • CORS-Enabled • Session-Based State Management