Singh AI Systems Case Study Amazon Ads Platform
Case Study · AdTech · AI Automation

Amazon Ads Budget Optimization Platform

A fully automated, AI-powered PPC campaign management system built solo — managing 659+ live Amazon Sponsored Products campaigns with a 3-layer rules engine, real-time stream automation, and GPT-5 anomaly detection.

Campaigns Live
0
Sponsored Products automated
Intraday Loop
15min
Stream rule execution cycle
AI Model
GPT-5
Anomaly detection & alerts
Automation Layers
3
Daily · Stream · AI Alerts
0Campaigns Managed
3Automation Layers
15mDecision Loop
14dAttribution Window
Amazon Ads API v3 Marketing Stream GPT-5 AWS SQS PHP / CodeIgniter
The Problem

Managing 659 Campaigns
Manually Doesn't Scale

Amazon Sponsored Products campaigns require constant budget vigilance. A campaign spending beyond its ACOS target at 2pm can drain a month's margin before a human analyst even opens their dashboard.

With 659+ active campaigns across dozens of product categories, manual monitoring was impossible. Budget decisions needed to happen in real time — and they needed to be data-driven, not guesswork.

The existing approach relied on end-of-day report reviews. By then, overspending had already happened. There was no intraday visibility, no automated guardrails, and no anomaly detection to flag campaigns behaving unusually.

The platform needed to think autonomously — reacting to Amazon's live stream data every 15 minutes, applying layered rules, and escalating edge cases to AI-powered analysis.

Before the Platform

Manual workflow pain points

  • No intraday visibility — budget decisions made on prior day's data only
  • ACOS spikes undetected until end-of-day report review
  • Out-of-budget campaigns silently losing impressions for hours
  • Attribution lag causing permanently stale optimization data
  • 659 campaigns — impossible to manually monitor at scale
  • Zero anomaly alerting — unusual spend patterns went unnoticed
  • No audit trail — budget changes undocumented and untraceable
System Architecture

Three-Layer Automation
Pipeline

Built end-to-end in CodeIgniter PHP on AWS — each layer operates independently on different data cadences, creating a resilient and intelligent automation stack.

Live Production System
End-to-End Automation
Architecture

Three distinct automation layers fire on different cadences — daily finalized reports, intraday stream events every 15 minutes, and AI-powered anomaly detection running continuously.

Layer 1 — Daily Rules Engine
Runs at 10 AM UTC on finalized T-1 ACOS/ROAS report data. Applies budget scaling rules per campaign using 7-day rolling performance windows. Full audit trail on every mutation.
Layer 2 — Stream Rules (Every 15 min)
Consumes Amazon Marketing Stream events via SQS → Lambda → MySQL. Uses Projected Intraday ACOS model (today's spend ÷ 7-day avg daily sales) gated by hour ≥ 10 AM ET. Detects out-of-budget campaigns in real time.
Layer 3 — AI Alerts (GPT-5)
OpenAI GPT-5 analyses campaign performance data for 8 anomaly types — ACOS spikes, burn rate anomalies, zero-sales events, cross-campaign deviation. Results cached 24 hours. Alerts surfaced to dashboard in real time.
Data Flow
Amazon Ads API v3
Daily NDJSON report pipeline
Marketing Stream → SQS → Lambda
Real-time intraday spend events
MySQL — Stream Performance DB
amazon_ads_stream_budget_daily_summary
GPT-5 Anomaly Detection
8 alert types · 24h result cache
Budget API Mutations + Audit Log
Amazon Ads API v3 · Full trail
659+Campaigns
15mCycle
8AI Alerts
Key Features

What the Platform Does

Every feature is in production, battle-tested against Amazon's live API — not a prototype.

Core Engine
Projected Intraday ACOS Model
Calculates a real-time ACOS estimate using today's stream spend divided by the 7-day average daily sales baseline — accurate, reliable, and gated by time-of-day to avoid early attribution noise.
  • Gated at hour ≥ 10 AM ET to avoid attribution lag
  • Minimum spend threshold prevents false positives
  • Replaces unreliable rolling-average approach
  • Non-zero baseline enforced before calculation
Stream Layer
Real-Time Budget Monitoring
Amazon Marketing Stream events flow through SQS → Lambda → MySQL every 15 minutes. Out-of-budget campaigns are detected from the stream daily summary table and actioned immediately.
  • SQS subscription active — 0 dropped events
  • Out-of-budget detection via stream budget daily summary
  • Stream rules assignable per-campaign
  • Full execution log per rule fire
AI Layer
GPT-5 Anomaly Detection
OpenAI GPT-5 analyses campaign performance across 8 anomaly dimensions — ACOS spikes, burn rate anomalies, zero-sales patterns, cross-campaign deviations, and more. Results are cached for 24 hours and surfaced instantly.
  • 8 distinct anomaly alert categories
  • 24-hour result cache for cost efficiency
  • Human-readable recommendations per alert
  • Priority scoring per campaign anomaly
Reporting
14-Day Attribution Window Refresh
Amazon report data settles over up to 14 days due to attribution lag. A dedicated daily cron re-fetches rolling 7-day windows at 2 AM UTC, ensuring optimization always uses settled, accurate performance data.
  • Runs at 2 AM UTC daily — before optimize cron
  • Handles both JSON array and NDJSON report formats
  • Prevents stale data from corrupting bid decisions
  • Separate from fetch_reports to avoid conflicts
Rules System
Rule Assignment Engine
Stream rules are independently created and assigned to individual campaigns or groups. Each rule defines conditions, thresholds, and actions — giving granular control over automation behavior per campaign.
  • Per-campaign rule assignment table
  • Independent rule creation and management
  • Conditions: ACOS %, spend threshold, out-of-budget state
  • Actions: budget increase/decrease, pause, alert
Compliance
Full Audit Trail
Every budget mutation, rule execution, and API call is logged with timestamp, campaign ID, old value, new value, triggering rule, and execution outcome — providing complete accountability and debuggability.
  • Every budget change recorded with before/after values
  • Rule execution log with trigger conditions
  • automation_enabled kill-switch per campaign
  • Amazon Ads API v3 pagination across all 659+ campaigns
Technology Stack

Every Tool Running
in Production

Not experimented with — deployed, integrated, and handling real campaign data every 15 minutes.

PHP 7 / CodeIgniter
Amazon Ads API v3
OpenAI GPT-5
AWS SQS
AWS Lambda
MySQL 5.7
Amazon Marketing Stream
AWS Secrets Manager
Bootstrap
Chart.js
AWS EC2
NDJSON Report Pipeline
PHP / CodeIgniter
Amazon Ads API v3
OpenAI GPT-5
AWS SQS
AWS Lambda
MySQL 5.7
Amazon Marketing Stream
AWS Secrets Manager
Bootstrap
Chart.js
AWS EC2
NDJSON Report Pipeline
Cron Automation Engine
Budget Mutation API
Projected ACOS Model
Stream Rules Engine
Attribution Window Refresh
Audit Trail System
Anomaly Detection Alerts
Campaign Sync Pagination
SQS Event Consumer
Daily Report Pipeline
Dashboard UI
Rule Assignment Engine
Cron Automation Engine
Budget Mutation API
Projected ACOS Model
Stream Rules Engine
Attribution Window Refresh
Audit Trail System
Anomaly Detection Alerts
Campaign Sync Pagination
SQS Event Consumer
Daily Report Pipeline
Dashboard UI
Rule Assignment Engine
Outcomes

System Metrics &
Platform Results

Every number below is live production data from the deployed system — not estimated, not projected.

0
Live Campaigns Managed
15m
Intraday Decision Loop
3
Automation Layers
14d
Attribution Window
8
GPT-5 Alert Types
100%
API v3 Compliant
My Contribution

Built Solo, End-to-End

Every layer of this system — from AWS infrastructure to dashboard UI — was designed, architected, and deployed by one person.

AI Automation Engineer
Designed and implemented the GPT-5 anomaly detection layer, alert caching strategy, and AI-to-dashboard integration pipeline.
Backend Developer (PHP / CodeIgniter)
Built the entire cron automation engine, rules evaluation logic, API mutation layer, and all model/controller architecture in CodeIgniter PHP.
AWS Infrastructure
Configured SQS queues, Lambda consumers, Secrets Manager integration, and EC2 cron scheduling for the full production environment.
Amazon Ads API Integration
Implemented the complete Amazon Ads API v3 pipeline — campaign sync with nextToken pagination, NDJSON report parsing, and all budget mutation endpoints.
Database Architecture
Designed the full MySQL schema across 14+ tables — stream performance, budget summaries, rule assignments, execution logs, keyword performance, and daily caps.
Dashboard UI
Designed and built the stream dashboard, rules management interface, AI alerts view, and campaign performance analytics using Bootstrap and Chart.js.
Interested in This?

Need a Similar
System Built?

If you're managing Amazon Ads manually — or any high-volume automated workflow — I can build a system like this for you. Let's talk about what you need.

Send a Message