PortfolioFahad Habib
Case study 03Event-driven infrastructure

Burst-Safe Webhook Gateway

Replaced a burst-sensitive ECS webhook endpoint with a serverless ingestion pipeline that preserved large payloads and reduced estimated monthly cost by more than half.

API GatewayLambdaSQSS3ECSCeleryEvent-driven
55%+

lower estimated monthly infrastructure cost

Under $100/mo

estimated monthly cost after redesign

>1 MB

payloads safely offloaded

Context

System context.

Background

The original webhook path accepted traffic on an ECS server and forwarded each event to Celery. Sudden bursts could overwhelm or restart the server, causing webhooks to be lost.

Challenge

Improve burst resilience without simply increasing always-on ECS capacity. The pipeline also had to account for occasional GHL payloads larger than SQS's 1 MB message limit.

Architecture

Architecture and implementation.

Before

Burst-sensitive ingress

Legacy

The ECS server acted as both the public entry point and the first handoff boundary, so a traffic burst could overwhelm it before Celery accepted the work.

GHL webhooksbursty traffic
ECS server2–4 tasks
Celeryasync handoff
Workersprocess events
After

Serverless buffered ingress

Current

API Gateway absorbs bursts, Lambda checks payload size, and S3 safely holds bodies that exceed the SQS message limit before asynchronous processing.

Webhook flow

GHL webhooksexternal events
API Gatewayserverless ingress
AWS Lambdapayload size check
Optional · > 1 MBAmazon S3stores oversized body
Amazon SQSpayload or S3 path
ECS consumerqueue bridge
Celery workersasync processing
01

Serverless ingress

Moved the public webhook endpoint to Amazon API Gateway so sudden traffic bursts would not depend on a fixed application server.

02

Payload-aware Lambda

Added a Lambda function that evaluates payload size before enqueueing each webhook.

03

Large-payload offloading

Stored payloads larger than 1 MB in S3 and placed the S3 reference on SQS; smaller events were written directly to the queue.

04

Asynchronous processing bridge

Used a small ECS consumer to drain SQS and route events to Celery workers for asynchronous business processing.

Outcome

Results.

  • Removed the fixed ECS web server as the burst-sensitive ingestion point.
  • Prevented large webhook payloads from exceeding SQS message limits.
  • Reduced estimated monthly running cost from about $200 to between $80 and $90.
  • Identified a further path toward roughly $40-$50 per month by moving the SQS consumer from ECS to EC2.