The problem

Picture a small neighbourhood bakery with about a dozen products: sourdough, croissants, buns, a few cakes. Every night the owner guesses how much to bake. Guess low and customers leave empty-handed by noon. Guess high and good bread goes in the bin at closing time.
The bakery already has two years of daily sales CSVs from its billing system. That's enough for a simple, useful goal: every evening, predict tomorrow's sales for each product and hand the baker a prep list. No chatbot, no real-time API, just a handful of AWS services that cost very little to run.

The pipeline

The top row runs every night and produces the prep list. The bottom row runs on Sundays and swaps in a new model only when it beats the current one.

Step 1: Store the data in Amazon S3

Each day's sales export lands in an S3 bucket under a dated prefix, like raw/sales/date=2026-11-28/. A second small file holds the product list with name, category and price. S3 is cheap, durable, and every other service in this pipeline can read from it directly.

Step 2: Prepare it with AWS Glue

An AWS Glue crawler scans both folders and registers their schemas in the Glue Data Catalog, so nobody hand-writes table definitions. A Glue ETL job then joins sales with products and turns each row into one product on one day, with the clues a good baker uses without thinking:

Two cleaning rules matter most. Drop days the shop was closed, or the model learns that some Tuesdays nobody wants bread. And flag sold-out days, because they hide true demand. With job bookmarks turned on, each nightly run processes only the new file. Amazon Athena is handy for quick SQL checks on the output.

Step 3: Train with Amazon SageMaker

Before training anything, set the bar. The baseline is the baker's own rule: bake what sold on the same day last week. If the model can't beat that, it isn't worth running.
The model is SageMaker's built-in XGBoost in regression mode. It handles small tabular data well, trains in minutes on a CPU instance, and needs no custom code. Split the data by time: train on everything except the last 8 weeks, then test on those 8 weeks. Measure mean absolute error in loaves, so the result is easy to explain: "we're off by about this many croissants a day".

Step 4: Predict with SageMaker batch transform

A real-time endpoint runs, and bills, around the clock. This bakery needs predictions once a day. So every night at 9 p.m., a batch transform job starts, scores tomorrow's dozen rows, writes the forecast to S3 and shuts down. A small step then rounds the numbers, adds a safety margin for best-sellers and produces the prep list.

Step 5: Automate and monitor

A forecast that needs someone to click buttons every night won't last a month. So the whole flow becomes a SageMaker Pipeline: prepare, train, evaluate, and register the new model only if it beats the current one.

  • Amazon EventBridge runs scoring every night and retraining every Sunday.
  • Amazon CloudWatch alarms catch failed runs or odd output, like predictions suddenly doubling.
  • Amazon SNS emails the owner when an alarm fires.
  • AWS Budgets alerts if monthly spend crosses a small limit, so a forgotten resource never becomes a surprise bill.

Comparing each week's real sales to the forecast is also the simplest drift check there is. A new café next door or a price change will show up there first.

Bonus: a prep note from Amazon Bedrock

A table of numbers works for me, but the baker would rather read a note. The last step sends the prep list to a foundation model in Amazon Bedrock, which writes five plain lines, like: "Saturday in Diwali week: bake extra sourdough and sweet buns. Rain after 4 p.m., so go lighter on the evening batch." The model only rewords numbers the forecast produced, and Bedrock Guardrails keeps it on topic.

The takeaway

The model was the easy part. Most of the work was getting clean data in, choosing a cheap way to serve predictions, and making the whole thing run without me.
If you're learning ML on AWS, pick a problem this size from real life: a shop, a club, your own expenses. Then take it all the way to "runs every night on its own". That last step is where you actually learn the job.