What it is
Amazon DynamoDB is a fully managed NoSQL database from AWS. It stores items by key and returns them in single-digit milliseconds at almost any scale. There are no servers or versions to manage. In on-demand mode you pay per read and write, so a quiet table costs close to nothing.
Tables are designed around access patterns: a partition key groups related items and a sort key orders them, so one query can fetch a day of records or the latest entry. Time-to-live deletes items automatically after a set time, and atomic counters make it a good fit for rate limits and tallies.
How I use it
- One table, keyed by kind of record, holds who is on the site right now, saved answers and votes, the activity log and the cached AWS bill.
- Time-to-live cleans up old visits on its own, and questions and answers are kept for 90 days.
- Per-visitor and site-wide daily caps on the agent, builder and receipt reader are counted in DynamoDB before anything that costs money.
- The status board keeps 24 hours of detail and a 30-day daily rollup.
- Repeat questions to the agent get a saved answer from DynamoDB, instantly and at no model cost.
DynamoDB is the right database when the questions are known in advance and simple: get this, count that, list today's. It suits serverless code because there is no connection pool to manage. For money and ledgers I use relational databases. For visits, counters and saved answers, one DynamoDB table is all it takes.
Questions
When should you use DynamoDB instead of MySQL or PostgreSQL?
When access patterns are simple and known, like counters, sessions and recent events. Anything that has to reconcile, like invoices or a ledger, I keep in a relational database.
How do you rate-limit an AI feature cheaply?
Count each request in DynamoDB with an atomic update before calling the model. My agent allows ten questions per visitor per day and has a site-wide daily cap.