AWS Builder Center
Amazon DynamoDB for Beginners

Amazon DynamoDB for Beginners

Understanding NoSQL and Building Your First Database

Introduction

When starting with AWS, one of the first questions beginners often have is:
“Which database should I use for my application?”
AWS provides several database services, and one of the most popular NoSQL options is Amazon DynamoDB.
DynamoDB is a fully managed, serverless NoSQL database designed for applications that need fast and predictable performance at scale. Unlike traditional relational databases such as MySQL or PostgreSQL, DynamoDB does not organize data primarily around tables with fixed columns and relationships.
Instead, DynamoDB uses a flexible data model based on tables, items, and attributes.
In this beginner-friendly guide, we will understand the basic DynamoDB concepts and create a simple database for a student application.



What Is Amazon DynamoDB?

Amazon DynamoDB is a fully managed NoSQL database service provided by AWS.
The important idea is that you don't need to manage database servers yourself.
AWS handles many infrastructure tasks such as:
  • Database infrastructure
  • Hardware provisioning
  • Software maintenance
  • Scaling
  • Availability
  • Replication
This allows developers to focus on building applications rather than managing database servers.
DynamoDB is commonly used for applications such as:
  • Web applications
  • Mobile applications
  • Gaming applications
  • IoT applications
  • E-commerce systems
  • Serverless applications
  • Real-time applications



DynamoDB vs Traditional SQL Databases

Before learning DynamoDB, it is useful to understand how it differs from a relational database.
A traditional SQL database might contain a table like this:
StudentID
Name
Email
Course
S001
Kasun
 kasun@example.com 
Computer Engineering
S002
Nimal
 nimal@example.com 
Computer Engineering
You normally define a schema containing columns such as  StudentID ,  Name ,  Email , and  Course .
DynamoDB takes a more flexible approach.
An item could look like:
{
"StudentID": "S001",
"Name": "Kasun",
"Email": "kasun@example.com",
"Course": "Computer Engineering"
}

Another item could contain additional attributes if the application's design requires them.
This flexibility is one of the important differences between NoSQL and relational databases.



Understanding the DynamoDB Data Model

There are three important concepts beginners should understand:

1. Table

A table is a collection of data.
For example:
Students

could be a DynamoDB table containing student records.

2. Item

An item is similar to a row in a relational database.
For example:
{
"StudentID": "S001",
"Name": "Kasun",
"Course": "Computer Engineering"
}

is one item in the  Students  table.

3. Attribute

An attribute is similar to a field or column.
For example:
StudentID
Name
Course

are attributes of an item.
The basic structure can therefore be understood as:
DynamoDB
│
└── Table
│
├── Item
│ ├── Attribute
│ ├── Attribute
│ └── Attribute
│
└── Item
├── Attribute
├── Attribute
└── Attribute




What Is a Primary Key?

One of the most important DynamoDB concepts is the primary key.
DynamoDB uses primary keys to uniquely identify items and efficiently retrieve them.
There are two main types of primary keys.

Simple Primary Key

A simple primary key contains only one attribute.
For example:
StudentID

We could create:
StudentID = S001
StudentID = S002
StudentID = S003

Each value must uniquely identify an item.



Composite Primary Key

A composite primary key contains:
  • Partition key
  • Sort key
For example:
StudentID AssignmentID
S001 A001
S001 A002
S002 A001

This is useful when an application needs to store multiple related items.
For example, a student could have multiple assignments.
Student
│
├── Assignment 1
├── Assignment 2
└── Assignment 3

The partition key groups related items, while the sort key allows them to be organized and queried within that group.



Creating Your First DynamoDB Table

Let's create a simple student table.
Go to the AWS Management Console and search for:
DynamoDB
Open the DynamoDB service.
Then select:
Create table
Use:
Table name:
Students

For the partition key, enter:
StudentID

Choose an appropriate data type such as:
String

For a simple beginner example, you can leave the sort key disabled.
Then create the table.
Your table structure will look conceptually like:
Table: Students

Primary Key:
StudentID




Adding Your First Item

After creating the table, open the table and navigate to the items section.
Choose:
Create item
Add an item such as:
StudentID = S001
Name = Kasun
Email = kasun@example.com
Course = Computer Engineering
Year = 1

DynamoDB stores this as an item.
You can add another item:
StudentID = S002
Name = Nimal
Email = nimal@example.com
Course = Computer Engineering
Year = 2

Now your table contains two items.



Reading Data

Applications need to retrieve information from the database.
For example, suppose our application needs the student with:
StudentID = S001

DynamoDB can retrieve the item using its primary key.
Conceptually:
Application
│
│ StudentID = S001
▼
DynamoDB
│
▼
Student information

This is one reason choosing a good key design is extremely important in DynamoDB.



DynamoDB and Serverless Applications

One of the most powerful combinations in AWS is:
Client
│
▼
API Gateway
│
▼
AWS Lambda
│
▼
DynamoDB

For example, imagine a student management application.
A student submits information through a web application.
The request goes to:
API Gateway
API Gateway invokes:
AWS Lambda
Lambda processes the request and stores the data in:
DynamoDB
The important part is that you don't need to manage a traditional application server or database server.
This architecture is known as a serverless architecture.



A Simple Real-World Example

Imagine building a university attendance application.
We could create a DynamoDB table called:
Attendance

An item might look like:
{
"StudentID": "S001",
"Date": "2026-08-26",
"Status": "Present",
"Time": "08:30"
}

Another record could be:
{
"StudentID": "S002",
"Date": "2026-08-26",
"Status": "Absent"
}

The application could use DynamoDB to store and retrieve attendance records.
A possible architecture would be:
Web Application
│
▼
API Gateway
│
▼
AWS Lambda
│
▼
DynamoDB
│
▼
Attendance Records

This is a simple example, but the same architectural principles can be applied to much larger applications.



DynamoDB Operations

When working with DynamoDB, you will commonly encounter four basic operations:

PutItem

Creates or replaces an item.
PutItem
↓
Create/replace data


GetItem

Retrieves a specific item using its primary key.
GetItem
↓
Retrieve one item


UpdateItem

Changes attributes of an existing item.
UpdateItem
↓
Modify data


DeleteItem

Removes an item.
DeleteItem
↓
Delete data

These operations form the foundation of many DynamoDB applications.



Query vs Scan

Another important concept for beginners is the difference between Query and Scan.

Query

A Query retrieves items based on a specific key condition.
For example:
Find all records for StudentID = S001

This is generally the preferred approach when the table is designed around the access pattern.

Scan

A Scan examines every item in a table to find matching data.
For example:
Search the entire table for students
whose Course = Computer Engineering

Scans can become expensive and inefficient as the amount of data grows.
Therefore, DynamoDB application design should focus heavily on efficient access patterns and key design.



Why DynamoDB Is Different

A common mistake beginners make is trying to design DynamoDB exactly like a MySQL database.
DynamoDB encourages a different approach.
With a relational database, developers often start by thinking:
“What tables and relationships do I need?”
With DynamoDB, it is often better to start by asking:
“How will my application access the data?”
For example:
What information do I need to retrieve?

How frequently will I retrieve it?

What will the query look like?

Which attributes should be used as keys?

This approach is known as access-pattern-driven design.
Understanding this concept is much more important than simply learning how to create a DynamoDB table.



DynamoDB and AWS Lambda

DynamoDB becomes particularly useful when combined with AWS Lambda.
For example, a Lambda function can receive an API request:
POST /students

The Lambda function can then create an item in DynamoDB.
The flow becomes:
User
│
▼
Web Application
│
▼
API Gateway
│
▼
Lambda
│
▼
DynamoDB

This architecture can automatically scale based on application demand without requiring developers to maintain traditional servers.



Security

When using DynamoDB, security should also be considered.
AWS Identity and Access Management (IAM) can control which AWS resources an application or user can access.
For example, a Lambda function might receive permission to:
Read from Students table
Write to Students table

while not being allowed to access unrelated databases.
A good principle is to grant only the permissions that an application actually needs.
This is known as the principle of least privilege.



Cost Considerations

One of the advantages of DynamoDB is that AWS provides different capacity and pricing options depending on application requirements.
For learning and experimentation, it is important to monitor your AWS usage and understand the pricing model before deploying production workloads.
Don't assume that “serverless” means “always free.”
Always check the current AWS pricing information before deploying applications that may generate significant traffic or storage.



Common Beginner Mistakes

Mistake 1: Treating DynamoDB like MySQL

DynamoDB is not simply a replacement for a relational database.
Learn its key-value and document-oriented data model.

Mistake 2: Ignoring access patterns

Before creating tables, think about how your application will retrieve the data.

Mistake 3: Using Scan for everything

Scanning an entire table can become inefficient as the dataset grows.

Mistake 4: Poor partition-key design

A poor key design can cause performance problems.

Mistake 5: Giving excessive IAM permissions

Applications should receive only the permissions they actually require.



What Should You Learn Next?

Once you understand the basics, the next DynamoDB concepts worth learning are:
  1. Partition keys
  1. Sort keys
  1. Query
  1. Scan
  1. Global secondary indexes
  1. Local secondary indexes
  1. Conditional writes
  1. DynamoDB Streams
  1. TTL
  1. Transactions
  1. IAM integration
  1. DynamoDB with AWS Lambda
You don't need to learn everything at once.
Start with the data model and key design first.



Final Thoughts

Amazon DynamoDB can initially feel very different from traditional SQL databases.
However, once you understand its basic concepts—tables, items, attributes, primary keys, and access patterns—the model becomes much easier to work with.
The most important lesson for beginners is not simply learning how to create a DynamoDB table.
It is learning how to design your data around the way your application needs to access it.
For someone learning AWS, a great next step is to combine DynamoDB with AWS Lambda and API Gateway and build a small serverless application.
That is where DynamoDB starts becoming more than just a database service—it becomes an important component of a scalable AWS architecture.
Any opinions in this article are those of the individual author and may not reflect the opinions of AWS.
Enjoyed reading this content? Let the author know!

Your likes, comments, shares, and saves help creators reach more builders.

Loading recommendations

Loading article