Skip to content

Repository files navigation

Mahashivratri High-Volume Donation Processor (AWS Serverless)

A production-grade, event-driven serverless architecture built with AWS CDK (Python). This project was designed to solve critical database bottleneck issues during massive, spiky traffic events (such as the Mahashivratri live stream).

The Business Problem

During large-scale global streaming events, the system experiences sudden, massive spikes in donation and registration traffic. Traditional monolithic REST APIs coupled directly to relational databases (RDS) often suffer from connection exhaustion, row-locking, and ultimately crash under the load, resulting in dropped requests.

The Serverless Solution

This architecture completely decouples the ingestion layer from the database processing layer using Amazon EventBridge.

  1. Ingestion: An API Gateway triggers a fast-executing Ingestion Lambda. This Lambda simply validates the payload, publishes a DonationReceived event to a custom EventBus, and immediately returns a 200 OK to the user.
  2. Routing: Amazon EventBridge routes the event asynchronously.
  3. Processing: A secondary Processor Lambda picks up the event and performs the heavy lifting (writing to the database, triggering emails, etc.).
  4. Storage: DynamoDB (configured with On-Demand PAY_PER_REQUEST billing) easily absorbs the sudden write capacity spikes without throttling.

Architecture Diagram

[ User / Frontend ] 
       │
       ▼ (HTTP POST)
[ Amazon API Gateway ]
       │
       ▼
[ Ingestion Lambda ] ──► (Returns 200 OK Fast!)
       │
       ▼ (Publishes Event)
[ Amazon EventBridge (Custom Bus) ]
       │
       ▼ (Asynchronous Trigger)
[ Processor Lambda ]
       │
       ▼
[ Amazon DynamoDB ]

Tech Stack

  • Infrastructure as Code (IaC): AWS CDK (Python)
  • Compute: AWS Lambda
  • API Routing: Amazon API Gateway
  • Event Bus: Amazon EventBridge
  • Database: Amazon DynamoDB

Code Structure

  • /lambda_functions/ingestion.py: The fast-response API handler.
  • /lambda_functions/processor.py: The asynchronous database writer.
  • /mahashivratri_donation_processor/: The AWS CDK Stack defining all IAM permissions, EventBridge rules, and infrastructure.

Deployment Instructions

This project is built using the AWS Cloud Development Kit (CDK).

# Create a virtual environment
python3 -m venv .venv
source .venv/bin/activate

# Install requirements
pip install -r requirements.txt

# Synthesize the CloudFormation template
cdk synth

# Deploy to your AWS Account
cdk deploy

About

Event-driven AWS serverless architecture built with CDK to process massive traffic spikes without database throttling.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages