CareerByteCode
ByteBlogby CareerByteCode
📰 Published in Chennai FutureTech Voices

Black Friday Architecture: One Click Through 11 AWS Layers

🟡 Intermediate

Black Friday architecture on AWS: learn how a 5,000-pair sneaker drop survives millions of shoppers and never oversells.

Black Friday Architecture: One Click Through 11 AWS Layers

✍️ Translate this blog into Hindi, Tamil or Telugu

Black Friday architecture comes down to one minute. It is 11:59 PM, millions of people are staring at the same product page, and a limited sneaker with only 5,000 pairs goes on sale at midnight. The site has to survive the crowd, and it must never sell pair 5,001.

The shoe drop in this article is a composite scenario I invented to make the mechanics easy to follow. It does not describe any one retailer's incident. The AWS layout is a reference pattern built from services AWS has confirmed at this scale, not a diagram Amazon has published. Published numbers from real operators are credited by name where they appear, and a section near the end separates what is confirmed from what is design.

Follow one shopper through it. She wants size 9, her thumb is over the button, and she is somewhere in that crowd. Every layer below exists to give her either a pair or an honest answer, and never a spinner that ends with a charge for a shoe that does not exist.

🛍️✨ From the author · ByteStore200-Question AWS DevOps, Kubernetes & Cloud Engineering Interview Guide (Medium/Hard, Full Answer Key)₹200View offer →

The short version: most of the crowd never reaches the servers, the stock is decided by one atomic write, and everything after payment goes through a queue that can retry. The rest of the article explains why each of those holds.

Two problems that look like one

Browsing a product page is a read. The same data is requested millions of times, and nobody is harmed if it is a few seconds out of date. Buying is a write. One number must go down by exactly one per purchase and must never drop below zero.

Almost every decision in this design exists to keep those two paths apart. Reads are cached, spread wide and allowed to be approximate. The write is narrow, protected and exact. If the crowd on the first path ever reaches the second, the database becomes the bottleneck and the drop fails in one of two ways: the site slows to a crawl, or it oversells.

reads versus one write

Black Friday architecture on AWS in one picture

The diagram below follows one shopper from the first request to the finished order. It is a reference design, so read it as a pattern and not as any company's real wiring. Three things are drawn on purpose: the edge filters traffic before it can reach anything expensive, the only way into the origin is through CloudFront, and the application and data layers are spread across more than one Availability Zone.

arch

Everything from the WAF rules and the locked origin to the multi-zone layout, the connection pool and the ledger database is design. The dashed login line shows the token riding along with later requests, not a second network path.

The first click, and why most of the crowd never gets past it

Our shopper opens the page at 11:59. Before she sees a single shoe, her browser asks DNS where the site lives. Route 53 answers, and the browser caches that answer for the length of its time to live. Every click after that skips DNS entirely, which surprises many people who assume each click triggers a lookup. DNS matters again only when something fails, which comes up later.

The edge: WAF and CloudFront

The next stop is the edge. AWS WAF looks at each request first and applies rate limits and bot rules, then CloudFront serves the product page and its images from cache. Think of the edge as the stadium gate: most of the crowd is checked and absorbed outside, and only a small fraction ever reaches the seats. AWS reports that CloudFront delivered over 2.1 trillion HTTP requests during the global week of Prime Day 2026.

The gate only works if the cache actually recognises repeat visitors. Bots and over-eager scripts often add a random value to the end of a URL, which makes every request look new to the cache, so each one falls through to the origin. The fix is cache-key hygiene: configure CloudFront to ignore query strings and headers that do not change the page, so thousands of slightly different URLs collapse into one cached copy, and let the WAF rate rules cut off clients that keep trying.

Closing the back door

None of that helps if a client can skip the gate. Anyone who finds the address of the load balancer or the API can call it directly, and every cache-busting request then lands on the origin. The usual fix is to make the origin accept only CloudFront: CloudFront adds a secret header that the origin checks, and the load balancer's security group allows only the CloudFront address ranges that AWS publishes as a managed prefix list. These are standard practices, not something any retailer has disclosed.

Login, API Gateway and the load balancer

Login happens next. A login service checks the credentials and hands the browser a signed token, and that token rides along with every later request. Amazon Cognito is one managed choice. Auth0, Okta, Keycloak or a custom service work the same way, because API Gateway can validate tokens from any standards-compliant provider. API Gateway checks the token and forwards the request to an Application Load Balancer, which spreads traffic across containers running on ECS with Fargate.

For a planned surge, the load balancer is worth preparing in advance. Application Load Balancer offers a capacity reservation for exactly this case. It sets a minimum capacity ahead of the event, and it replaces the older habit of opening a support case to have the balancer pre-warmed. A spike that arrives in seconds can outrun the automatic scaling that normally handles growth. The reservation is spread evenly across zones, so each zone needs a similar number of healthy targets behind it, and it is billed until you cancel it. The balancer's peak capacity metric from past traffic or a load test is the guide for sizing it.

Readiness checks before the event

Then comes the unglamorous work that matters as much as any clever design. Review the AWS Service Quotas that the design touches, such as API Gateway throttling, Fargate task limits and DynamoDB throughput, and request increases early because they are not instant. Then check the limits that live outside AWS. A payment gateway that caps requests per second will throttle checkout no matter how many containers you run, so ask its provider for the limit and a plan for the event. Warm the ElastiCache layer with the hot product data before midnight so the first wave does not all miss the cache at once. These are readiness steps from common practice, not disclosures from any operator.

Scaling is rehearsed, not improvised

A flash sale climbs faster than reactive autoscaling can follow. Metrics lag by a minute or more, and containers need time to start. By the time a CPU alarm fires and new tasks are running, the first wave has already passed: at five seconds past midnight the crowd is already inside, and a container that finishes starting at fifty seconds past is late. For a known event the practical answer is scheduled scale-out ahead of the clock, with target tracking as a safety net and not the main plan.

The published evidence points the same way. AWS reports that ECS launched an average of 158.3 million tasks per day on Fargate during Prime Day 2026, up 47.7 percent from the previous year. The same post reports more than 44,000 AWS Fault Injection Service experiments, over six times the 2025 count. AWS does not say what drove that increase, so I will not guess.

Rehearsal in public: Shopify

Shopify offers the clearest public account of rehearsal. Its team ran five major scale tests between April and October 2025. The early tests threw errors and let checkout queues back up. The fourth reached 146 million requests per minute and more than 80,000 checkouts per minute, and it hit limits that triggered an unplanned failover. The final test targeted a 99th percentile forecast of 200 million requests per minute and ran as a full dress rehearsal during business hours. Shopify's actual peak at the edge that weekend was 489 million requests per minute. Shopify runs on Google Cloud, so the lesson is about method and not about any one provider: finding the limit in April is cheap, and finding it at midnight on Black Friday is not.

scaling before the rush

The one write that decides

A wish list is not a reservation. Saving the shoe stores a user and a product and nothing more, which is why the shopper who wish-listed it a week ago has no advantage at midnight. Stock is tracked per size, so size 9 has its own counter.

The atomic conditional write

When someone presses buy, the stock record receives a single conditional update. In DynamoDB it looks like this sketch:

UpdateItem
  Key:                 { sku: "SHOE-01#size-9" }
  UpdateExpression:    "SET stock = stock - :one"
  ConditionExpression: "stock >= :one"
  :one = 1

The check and the decrement happen as one atomic operation on one item. Two buyers cannot both take the last pair, because the database applies the changes one at a time. The loser receives a ConditionalCheckFailedException, and the application turns that into a clear sold out message. Buyer 5,001 learns the truth here and nowhere earlier. Our shopper might be buyer 4,998 or buyer 5,001. The database does not know her, it only knows the count. AWS reports that DynamoDB peaked at 192 million requests per second during Prime Day 2026 with single-digit millisecond responses.

Sharding the counter

There is a catch the happy-path diagrams skip. Every buyer is hitting the same item, and a single DynamoDB item has a ceiling on writes per second. A common remedy is to split the 5,000 pairs across several counters, for example ten counters of 500, and spread buyers across them. The tradeoff is that the last few pairs can sit stranded in a counter while another is empty. Moving live stock between counters in the middle of the stampede would add a second contested write at the worst moment, so the cleaner pattern is to leave the shards alone while the drop runs. Each shard sells down on its own. When a shard reports sold out, the buyer is routed to another shard that still has stock. Once the rush is over, an end-of-drop sweep totals what is left in each shard, closes any hold still open and returns the stock to one pool for whatever comes next. Holds themselves are a separate job, because they must be released continuously during the drop and not at the end, as the next paragraphs explain. I consider this the most interesting problem in the whole architecture.

Holds as a state machine

Most stores also place a short hold once checkout starts, then release the pair if payment does not finish. It helps to model the hold as a small state machine with three outcomes. A hold starts as RESERVED when the conditional write succeeds. It becomes CONFIRMED when payment completes, or EXPIRED when the timer runs out, or RELEASED when the payment fails or the shopper abandons the cart. Each move is its own conditional write that checks the current state, so a late payment cannot confirm a hold that has already expired, and stock is never returned twice. If a payment is captured just after its hold expired, the order is voided or refunded instead of confirmed, so nobody pays for a pair they cannot have.

The expiry needs an active, deterministic trigger such as a delayed message, a per-hold timer or a scheduled sweeper that looks for holds past their deadline. DynamoDB's built-in time to live deletion is background cleanup, not a release trigger. AWS says expired items are typically deleted within a few days, and until they are deleted they still appear in reads unless the query filters them out. Stock released that way could stay locked up long after the shopper left. AWS's own database blog shows a scheduler-driven pattern that brings eviction down to about a minute or two, which is the kind of trigger a hold needs. Use TTL to tidy old records, and use the sweeper to put stock back on sale.

Where the money lives

One more split is worth stating. The fast, high-concurrency state, meaning stock counters, holds and sessions, lives in DynamoDB. The financial record of orders, payments and refunds, and its later reconciliation, belongs in a transactional relational store, either Amazon Aurora or standard Amazon RDS with Multi-AZ, where multi-row transactions and audit queries are natural. Aurora is part of the RDS family, so the choice is about features and cost and not about a different kind of database. The ledger only sees confirmed orders, so either one can handle the write rate. Aurora keeps its storage across three zones and offers easier failover and read replicas for reconciliation queries, while standard RDS is the simpler and cheaper choice if your team already runs it. Keeping them apart stops a ledger query from competing with the stock write. Whichever engine you pick, put RDS Proxy in front of it. Hundreds of Fargate tasks each opening their own connections can exhaust a database during a spike, and the proxy pools them. The two stores cannot commit together, so each confirmed order is written to the ledger with the order identifier as an idempotency key, which means a retry after a crash does not create a second entry.

🛍️✨ From the author · ByteStoreCloud Architecture Review₹550View offer →

the atomic write

After the purchase: how an order survives a crash

Once payment succeeds, the order goes onto an SQS queue. Email, warehouse and fraud workers pull from it at their own pace, so the spike hits the queue and not the services behind it. AWS reports a peak of 213 million messages per second on SQS during Prime Day 2026.

Fan-out to independent consumers

A single queue is the simple version. At larger scale, teams often publish the order event once and let several consumers listen. With an Amazon SNS topic, each consumer gets its own SQS queue. With a Kinesis Data Stream, each consumer reads the stream directly and keeps its own place in it. Either way, fulfillment, customer notifications, fraud checks and analytics each scale, slow down and fail independently, so a broken analytics job cannot hold up the confirmation email. This fan-out is a common pattern and part of the reference design, not something AWS has said about Amazon's own order flow.

Retries and the dead-letter queue

Failure handling is where queues earn their keep. When a worker receives a message, SQS hides it for the length of the visibility timeout. If the worker finishes and deletes the message, the work is done. If the worker crashes, the message reappears after the timeout and its receive count goes up by one. Once the count passes the configured maximum, SQS moves the message to a dead-letter queue, an alarm fires, and an engineer inspects the message and replays it after the fix.

Standard queues deliver each message at least once, which means the same order can arrive twice. The workers therefore have to be safe to run twice. The usual technique is to use the order identifier as an idempotency key, so a retried payment capture or a repeated confirmation email has no second effect. FIFO queues reduce duplicates but carry lower throughput limits, which is why a standard queue with idempotent workers is the common choice at flash-sale scale.

queue and dead-letter queue

Watching it work: the dashboard that lies

CPU graphs are a poor guide during a drop, because a dashboard can be green while checkout fails. The worst night of an on-call shift is a wall of green panels next to an inbox full of customers who cannot pay. The numbers that matter sit closer to the customer: the load balancer's server error count and target response time, the age of the oldest message in the queue, the number of messages waiting in the dead-letter queue, and a custom metric for checkout success rate. Add the error and timeout rate of the payment provider and of every other downstream call, because a third party failing looks like your own checkout failing. Add custom hold metrics too, published by your own code: how many holds are active, how many expired, and how much stock the sweeper reclaimed. A climbing expiry count means shoppers are reaching payment and not finishing, which is a problem you want to see before the drop ends. Put the checkout success rate next to the infrastructure panels so a team can see in seconds whether a slow database is costing sales. AWS reports that CloudWatch handled over 2.15 quadrillion metric observations per day during Prime Day 2026, which gives a sense of how much telemetry a large event produces.

When something breaks: what two real outages teach

Route 53 returns to the story at this point. Its health checks watch the endpoints, and when a region goes unhealthy, the answers for new lookups change. Shoppers whose cached answer has not expired keep going to the old address until it does, so the record's time to live should be lowered well before the event and not during the emergency. This is common practice and not a confirmed detail of any retailer.

Two real outages

The harder failures are the ones nobody drew on the diagram. Coinbase published a postmortem for an outage on May 7, 2026. A cooling failure in one AWS data hall took down part of one availability zone, and its matching engine, a five-node cluster placed close together for speed, lost quorum when three nodes went offline. Event streaming workloads were stranded in the same zone, which slowed recovery even after trading systems began to return. Railway's outage on May 19, 2026 had a different shape. An automated action suspended its production account at Google Cloud. Workloads on other clouds initially kept running, but its edge proxies pulled their routing tables from a control plane hosted in the suspended account. Once the cached routes expired, which Railway's report places within roughly the first hour, requests began returning 404 errors even though the workloads behind them were still online.

Both cases say the same thing about failover plans. A second region protects against a region failing, but it does nothing for a quorum placed in one zone or for a control plane that sits inside the account that gets suspended.

What it means for this design

Tie that back to the diagram. The two Availability Zones in the application tier are there so that losing one data hall leaves the other serving checkout. Coinbase shows why spreading matters: its five matching-engine nodes sat close together, so one zone's failure took out the majority. Any cluster that needs a quorum, such as a lock service or a stream broker, needs three zones and not two, with members placed so that no single zone holds more than a minority. Five nodes split across two zones still lose the larger half when one zone goes. A checkout flow does not need the microsecond latency that led Coinbase to pack its nodes together, so the cost of spreading is small here.

Railway shows the other half. Its own list of fixes is to remove the single routing dependency, spread database quorum across clouds, and take Google Cloud out of the hot path of the data plane. For this design the same idea means keeping the routing and control-plane pieces that every request needs outside the blast radius of the account that hosts the workloads, and keeping the last known good routes with no expiry, so a control plane outage freezes routing in place instead of erasing it. A second region inside the same account would not have helped, because the suspension covered the whole account. These are design choices drawn from the two postmortems, not a claim that either company runs this layout. Shopify's unplanned failover in its fourth scale test is the useful counterpart, because it shows a team discovering that kind of dependency on a Tuesday afternoon in rehearsal.

What is confirmed and what is design

AWS has confirmed the scale of DynamoDB, SQS, Lambda, CloudFront, ElastiCache, Fargate and CloudWatch during Prime Day 2026, along with the fault injection program. Shopify has published the shape of its scale tests and game days. Coinbase and Railway have published their own postmortems. Those are the facts in this article.

Several layers are design, not disclosure. AWS's Prime Day post does not mention Route 53, WAF or load balancing, and Amazon has not published how it handles inventory contention, holds or order queuing. The conditional write, the cart hold and the queue flow above are the standard patterns that the DynamoDB and SQS documentation describe. The same goes for the pieces added to the diagram in this version: the WAF rules and cache-key filtering, the origin locked to CloudFront, the multi-zone layout, the sharded counters with an end-of-drop sweep, the reservation state machine with its sweeper, the split between DynamoDB and a relational ledger with a connection pool, and the SNS or Kinesis fan-out. They are patterns you could build, and none of them is an Amazon or retailer disclosure. Treat the whole thing as a reference architecture, and not as a description of how Amazon's retail site works.

Back to pair 5,001

Pair 5,001 never sells because the stock write is atomic and narrow. The site stays up because the edge and the cache absorb the crowd long before it reaches that write. No order is lost because the queue and the dead-letter queue catch what a failed worker drops, and the team trusts all of it because they broke it on purpose months earlier.

If our shopper turned out to be buyer 5,001, she got a plain sold out message and was never charged, and that is the whole point of the design.

Which layer would you break first in a rehearsal: the cache, the queue or the stock write? Tell me in the comments, and follow me here on ByteBlog for the next teardown. 

#CareerByteCode #AWS #SystemDesign #CloudArchitecture #DevOps

📚 Sources
  1. aws.amazon.com/blogs/aws/all-the-numbers-amazon-prime-day-2026-powered-by-aws/
  2. shopify.engineering/bfcm-readiness-2025
  3. cloud.google.com/customers/shopify-compute
  4. infoq.com/news/2026/06/coinbase-aws-failure-postmortem
  5. blog.railway.com/p/incident-report-may-19-2026-gcp-account-outage
  6. docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/restrict-access-to-load-balancer.html
  7. docs.aws.amazon.com/amazondynamodb/latest/developerguide/TTL.html
  8. aws.amazon.com/blogs/database/implement-event-driven-architectures-with-amazon-dynamodb
  9. docs.aws.amazon.com/elasticloadbalancing/latest/application/capacity-unit-reservation.html
Read next →Multi-Cloud Linux Deployment on AWS and Azure⏱ 11 min

🛍️ Infantus Godfrey's shelf

Courses, cohorts and more from the author
Infantus Godfrey
Written by Infantus Godfrey
Senior Cloud & DevOps Engineer · AWS · Kubernetes · Terraform · DevSecOps
🏅 Rookie writer

A Senior Cloud & DevOps Engineer with 6+ years across AWS, Azure, Terraform, and Kubernetes. An active voice in the DevSecOps community through CareerByteCode. I organizes this event to bring people together around real, hands-on cloud and AI work.

Visit my ByteStoreEngineering cloud systems that scale, stay secure, and run themselves

Get Infantus Godfrey's next blog by email

One email a week when they publish. Add the weekly Best of ByteBlog too. No spam, unsubscribe with one click.

We email you once to confirm. By subscribing you agree to the privacy policy.

💬 Comments (0)

Top · Newest

Sign in to comment

Related blogs

🛍️✨ From the author · ByteStore200-Question AWS DevOps, Kubernetes & Cloud Engineering Interview Guide (Medium/Hard, Full Answer Key)₹200View offer →