Skip to content
Tutorials Center
My learning

Topics

Lesson 1 of 37 ยท Getting Started

What Is Amazon DynamoDB?

Learn what Amazon DynamoDB is, how a serverless key-value and document database works, what it is good at, and when you should pick something else.

Amazon DynamoDB is a fully managed NoSQL database from AWS. You do not install it, patch it or size a server for it. You create a table, tell the service how to find your data, and then read and write items over an HTTPS API. DynamoDB stores the data on solid-state drives across several data centers in a region and keeps latency in the single-digit milliseconds, whether the table holds a thousand items or a few billion.

That promise comes with a trade. DynamoDB is very fast and very predictable because it only lets you ask questions it can answer by going straight to the data. There are no joins, no ad-hoc WHERE clauses across the whole table, and no query planner that rescues a bad design. This course teaches you to design for that trade instead of fighting it.

Everything here runs without an AWS account. DynamoDB itself cannot run in your browser, so real API calls, CLI commands and SDK code appear as read-only blocks, and the runnable examples are small Python stand-ins that model the same ideas. They are labelled as stand-ins every time.

A key-value and document database

At its core DynamoDB is a key-value store: you give it a key and it returns the value stored under that key. The value is not an opaque blob. It is an item, a set of named attributes (a document), and DynamoDB can read, filter and update individual attributes inside it.

JSON
{
  "UserId": "u-1001",
  "Name": "Amina",
  "Plan": "pro",
  "Tags": ["beta", "newsletter"],
  "Address": { "City": "Lagos", "Country": "NG" }
}

Items in the same table do not have to share the same attributes. Only the key attributes are mandatory. That is what "schemaless" means here: the database enforces the key, and your application enforces everything else.

What "fully managed" and "serverless" mean

  • No servers to run. You never see a host, an operating system or a disk. AWS handles replication, hardware failures and software upgrades.
  • Built-in replication. Every write is stored in three Availability Zones in the region before it is acknowledged as durable.
  • Scaling by configuration. You choose on-demand mode (pay per request) or provisioned mode (reserve read and write capacity). Both are covered in the capacity chapter later in the course.
  • Pay for use. You are billed for storage, requests and optional features, not for idle machines.
flowchart LR
    A["Your application<br/>SDK or CLI"] -->|"HTTPS API call"| B["DynamoDB<br/>request router"]
    B --> C["Partition 1"]
    B --> D["Partition 2"]
    B --> E["Partition 3"]
    C --- F["Replicas in 3<br/>Availability Zones"]
    D --- F
    E --- F

Requests go through a router that sends each one to the partition holding the key.

Why it is fast: hashing the key

When you write an item, DynamoDB runs the item's partition key through a hash function. The result decides which physical partition stores the item. When you read with the same key, the same hash leads straight to the same partition. There is no scan and no index search over the whole data set, so the cost of a lookup does not grow as the table grows.

The next example is a stand-in. It is not DynamoDB's real hash function, but it shows the idea: a stable hash maps keys to a fixed set of partitions.

Python Stand-in: route keys to partitions with a hash

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Run it twice: the output never changes, because the hash is deterministic. That is why a read can go straight to the right partition without asking anyone else.

A tiny table you can touch

This second stand-in keeps items in a Python dictionary keyed by a partition key. It shows the two most basic operations, PutItem and GetItem, and the fact that items need not share attributes.

Python Stand-in: PutItem and GetItem on a dict

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Notice that the second put_item for u-1 replaced the item completely: the Plan attribute is gone. The real PutItem behaves the same way, which is why the update operations in a later lesson exist.

What DynamoDB is good at

  • Key-based lookups at any scale: sessions, user profiles, shopping carts, game state, device settings.
  • Predictable latency under heavy load, because each request touches one partition (or a small, known range inside it).
  • Spiky or unknown traffic: on-demand mode absorbs bursts without capacity planning.
  • Event-driven designs: Streams, TTL and Lambda triggers are built in (see the streams chapter later).
  • Very high write volumes: ad impressions, IoT readings, event logs.

What it is not good at

  • Ad-hoc analytics and reporting. Questions you did not design for are slow or impossible. Export to a warehouse instead.
  • Complex relational queries. No joins and no foreign keys. If your data is highly relational and queried in changing ways, a relational database is simpler.
  • Large objects. An item is limited to 400 KB. Store files in Amazon S3 and keep a pointer in DynamoDB.
  • Full-text search. Use a search service next to it.

The honest summary: DynamoDB rewards you when you know your access patterns up front. See DynamoDB vs relational databases for the design differences in detail.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. What does it mean that DynamoDB is fully managed?

    There are no servers for you to operate. AWS handles hardware, replication and upgrades, and you work with tables through an API.
  2. 2. Why does a lookup by partition key stay fast as a table grows?

    The partition key is run through a hash function, so a read goes directly to one partition instead of searching the full table.
  3. 3. Which workload is the weakest fit for DynamoDB?

    DynamoDB has no joins or flexible query planner. Unplanned analytical questions belong in a warehouse or a relational database.
  4. 4. What is the maximum size of a single DynamoDB item?

    An item, including attribute names and values, can be at most 400 KB. Larger objects go into S3 with a pointer stored in DynamoDB.

Summary

  • DynamoDB is a managed, serverless NoSQL database that stores items (documents) addressed by key.
  • Hashing the partition key sends each request to one partition, which keeps latency low at any size.
  • Items in one table may have different attributes; only the key attributes are required.
  • It excels at key-based access, high throughput and spiky traffic, and is a poor fit for ad-hoc joins and analytics.
  • You design the table around your access patterns, not around the shape of your data.

Next: Tables, Items and Attributes