Skip to main content
Skip to main content
Still in beta — questions, comments or suggestions? aramb@aramb.dev

DynamoDB

Learn about Amazon DynamoDB, AWS's serverless NoSQL database designed for performance at any scale.

15 min
Introductory
AWS Free TierFREE TIER

All services used in this lesson are covered by the AWS Free Tier.

AWS Services Used

Amazon DynamoDB25 GB of storage and 25 RCU/WCU (Always Free)

Learning outcomes

By the end of this lesson, you will be able to:

  1. Explain what Amazon DynamoDB is.
  2. Distinguish DynamoDB from a relational database like RDS.
  3. Explain the basic DynamoDB data model: tables, items, and attributes.
  4. Recognize the importance of the primary key in DynamoDB design.
  5. Explain the difference between on-demand and provisioned capacity.

What DynamoDB is

DynamoDB is AWS’s serverless NoSQL database for applications that need fast, consistent performance at scale without managing database servers. It is designed to deliver single-digit millisecond performance whether you have 100 users or 100 million.

A simple memory rule:

  • RDS/Aurora = Relational database (SQL).
  • DynamoDB = NoSQL key-value/document database.

1) What is Amazon DynamoDB?

Amazon DynamoDB is a serverless, fully managed, distributed NoSQL database.

  • Serverless: You don't provision servers, patch software, or worry about disk space.
  • Fully Managed: AWS handles all the infrastructure, maintenance, and high availability.
  • Distributed: Your data is automatically spread across multiple servers and Availability Zones for durability.

2) How it differs from Relational Databases

DynamoDB is fundamentally different from services like RDS or Aurora:

  • No Joins: DynamoDB does not support SQL JOIN operations.
  • Schema-less: While every item needs a primary key, other attributes can vary from one record to the next.
  • Scaling: It scales horizontally to handle virtually unlimited traffic without performance degradation.
  • Design: You design your table based on your access patterns (how you query) rather than just how the data is related.

3) The Data Model: Tables, Items, and Attributes

DynamoDB uses a simple hierarchy to organize data:

Tables

A collection of data records. (e.g., a Users table).

Items

A single record within a table. This is similar to a "row" in a relational database.

Attributes

A data field within an item. This is similar to a "column."

Tip

Mental Model: Table = The whole list. Item = One person on the list. Attribute = That person's First Name, Age, or Email.


4) The Primary Key

Every item in a table must be uniquely identified by a Primary Key. There are two types:

  1. Simple Primary Key (Partition Key): A single attribute (e.g., UserID).
  2. Composite Primary Key (Partition Key + Sort Key): Two attributes used together (e.g., UserID + OrderDate). This allows you to store multiple items for the same user and sort them by date.

5) Capacity Modes

How do you pay for DynamoDB? You choose a capacity mode:

On-Demand Mode

  • Pay-per-request: You only pay for what you use.
  • Automatic Scaling: Handles unpredictable traffic spikes instantly.
  • Best For: New apps, unknown traffic, or "spiky" workloads.

Provisioned Mode

  • Defined Capacity: You specify exactly how many reads/writes per second you want.
  • Cost Predictable: Good for steady, predictable traffic.
  • Best For: Established apps with consistent usage.

Micro-activity 1: SQL or NoSQL?

Micro-Activity

Database Type Selection

Based on the app needs, which database style is the better fit?

Examples

Choose one, then match it on the right

Characteristics

Select an example first

0 of 4 matched so far.

Micro-activity 2: Capacity Modes

Micro-Activity

Capacity Selection

Which mode should you choose for these traffic patterns?

Examples

Choose one, then match it on the right

Characteristics

Select an example first

0 of 4 matched so far.


Summary

Amazon DynamoDB is the workhorse of modern, serverless AWS applications. It provides incredible speed and scale by trading away the complexity of SQL joins for a simpler, high-performance key-value model.


Knowledge Check

Knowledge Check
1 / 5

What is Amazon DynamoDB?

Next lesson

Lesson 4.15: Redshift and ElastiCache