Inventory Agent on AWS

Ship an AI agent to AWS

You start with an inventory-planning agent that runs on a laptop. You finish with a live, secured deployment on AWS that updates itself when you push code and disappears with one click when you are done.

What you are building

A chat assistant for a shop's stock manager. Ask it “Should I reorder SKU002?” and it looks up live stock in a database, runs the reorder calculation, and answers in plain English: “Yes, order 55 units now.”

Under the hood it is the most common shape of AI product being built today: a chat page talks to an API, which runs an AI agent (LangChain with an OpenAI model) that calls tools to read company data. Learn to deploy this one properly and you can deploy an HR assistant, an IT helpdesk bot or a sales copilot the same way.

On AWS it runs as two containers on ECS Fargate, behind a load balancer, inside a private network, with its database on EFS and its keys in Parameter Store. All of it is described in one CloudFormation file. If those words mean nothing yet, that is exactly what Part 1 is for.

The route through this guide

Follow the parts in order. Each one ends where the next begins.

Before you begin

  • An AWS account with an IAM user that has administrator access and a CLI access key. Not the root login.
  • An OpenAI API key on a project with billing enabled and a monthly spend limit set.
  • On your laptop: AWS CLI version 2, Docker Desktop, and a bash shell (macOS and Linux have one; on Windows use WSL or Git Bash).
  • For Part 3: a GitHub account.

If you have seen the Azure version

This guide is a port of an earlier Azure Container Apps deployment of the same app. The app logic is unchanged. What differs:

  • The language model moved from Groq (Llama 3.3) to OpenAI (gpt-4o-mini by default, configurable).
  • About ten Azure CLI commands, including a hand-written REST call to attach the disk, became one CloudFormation template deployed with one command.
  • Images are pulled with an IAM role instead of a registry admin password.
  • Two latent bugs were fixed: the disk now mounts at /app/data so it no longer hides schema.sql, and the health check no longer depends on curl, which the image does not contain.

Part 1 has a full side-by-side comparison and explains why each difference matters.

For instructors

  • Part 1 works as pre-reading or as the lecture itself. The request stepper and the cost calculator are designed to be driven live on a projector.
  • Part 2 is the lab. It ends with a two-hour session plan, a pre-class checklist, and a troubleshooting method you can teach as a skill in its own right.
  • Part 3 works as a live demo (edit one line on GitHub, watch it deploy) or as homework with five graded-difficulty exercises.
  • Look for the dashed Teaching tip boxes: they mark the moments that land best in a classroom.
  • Every page is a single file that works offline, prints cleanly (Ctrl+P or Cmd+P), and has a dark mode for screens.