Reference architecture

Real-time bidding on serverless

Live auctions with strict bidding rules, instant updates to every bidder, and a full audit trail, without a single always-on server.

All architectures
real-time-bidding.ts
Real-time bidding architecture: bidders call API Gateway and a bid Lambda that writes to DynamoDB with a conditional transaction and, once it succeeds, publishes the new high bid to IoT Core. Every bidder watching that auction is subscribed to its topic and receives the update in real time over MQTT. Separately, DynamoDB Streams feed EventBridge through Pipes, which fans out to an SQS queue that sends outbid alerts by email, SMS or push to bidders who are not watching and to Firehose for an S3 bid history queried by Athena.BidderWeb · MobileAPI GatewayREST · AuthLambdaPlace bidIoT CoreTopic per auctionEventBridgeBidPlacedDynamoDBStreams → PipesBiddersLive updates · MQTTSQSRetry · DLQFirehoseBatch to S3Outbid alertsEmail · SMS · pushS3 + AthenaBid history

The problem

Auctions combine hard consistency rules (reserve prices, minimum increments, start and end times) with bursty, real-time traffic. Every bidder needs to see a new high bid within moments, two simultaneous bids must never both win, and the business needs a complete, queryable history of what happened.

Key design decisions

  1. 01

    Enforce bidding rules with conditional writes

    The auction item stores the next minimum acceptable bid. A transactional write records the bid and updates the auction only if the new amount meets that minimum and the auction is still open, so simultaneous bids are resolved by the database, not by locks in application code.

  2. 02

    Single-table design for auction access patterns

    Auctions, bids and bidder views share one table with composite keys, so the hot paths (current state, bid history, a bidder's activity) are each a single query.

  3. 03

    Publish events from the database, not the function

    Accepted bids flow from DynamoDB Streams through EventBridge Pipes onto the event bus. An event is emitted only if the write committed, so a crash or failed publish in the bid function can never lose one or invent one. Notifications, the audit trail and analytics all hang off this path.

  4. 04

    Durable work behind queues

    Live updates only reach bidders who have the auction open, so outbid alerts reach everyone else by email, SMS or push and bring them back to bid again. Because a missed alert can cost the seller a higher bid, consumers like this read from their own SQS queue with retries, a dead-letter queue and redrive, so a failing downstream never loses an event or blocks the others.

  5. 05

    Push live updates straight from the bid function

    Once the conditional write succeeds, the bid function publishes the new high bid directly to the auction's IoT Core topic, which browsers receive over MQTT on secure WebSockets. Skipping the stream keeps updates as fast as possible, and because the message is best-effort, a missed one is corrected by the next bid or when the client reconnects and reloads the auction.

  6. 06

    Event history in a queryable data lake

    EventBridge also delivers every event to Firehose, which writes compressed batches to S3 for auditing and Athena analytics at storage prices.

Have a system to build, or a cloud bill to tame?

Tell us what you're working on. We'll come back within one business day with next steps.