# DynamoDB

Amazon DynamoDB is a fully managed NoSQL database service offered by Amazon Web Services (AWS).&#x20;

It is designed for developers who need a fast, scalable, and highly available database for modern applications.

it can store any amount of data and serve any amount of traffic, therefore, you can expect a good performance even when it scales up.

<figure><img src="https://921544542-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FiRQTWHUNVZ5tIxQJXclF%2Fuploads%2FbvIbfCfJjZonys6WjPcB%2F70553550-f033b980-1b40-11ea-9192-759b3b1053b3.png?alt=media&#x26;token=0a386098-208d-4ead-a4b7-03322d1e96a2" alt=""><figcaption><p>DynamoDB</p></figcaption></figure>

### Architecture

<figure><img src="https://921544542-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FiRQTWHUNVZ5tIxQJXclF%2Fuploads%2FxREVuj0E3CewLvOqQbWx%2F116.png?alt=media&#x26;token=2b2248e4-bf10-4cf6-bda1-6d8007e468d9" alt=""><figcaption><p>Architecture</p></figcaption></figure>

At a high level, Amazon DynamoDB is designed for high availability, durability, and consistently low latency (typically in the single digit milliseconds) performance.

Amazon DynamoDB runs on a fleet of AWS managed servers that leverage solid state drives (SSDs) to create an optimized, high-density storage platform.&#x20;

This platform decouples performance from table size and eliminates the need for the working set of data to fit in memory while still returning consistent, low latency responses to queries.&#x20;

As a managed service, Amazon DynamoDB abstracts its underlying architectural details from the user.

### DynamoDB Workflow

<figure><img src="https://921544542-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FiRQTWHUNVZ5tIxQJXclF%2Fuploads%2Fhl6uuG7UClPtB05xtd4V%2F73771869-c49a0d80-4744-11ea-9594-b29225b929ba.png?alt=media&#x26;token=6f5120d6-d9f2-46be-aa5c-1461169b404a" alt=""><figcaption><p>DB Workflow</p></figcaption></figure>

Main Components

1. Attributes

This is the simplest element in DynamoDB that stores data without any further division. Each attribute has a name and a value.&#x20;

DynamoDB supports various data types for attributes, including strings, numbers, binary data, lists, and maps. Attributes are used to store the actual data in your items.

2. Items

Items are individual data records within a DynamoDB table.

3. Tables

Tables are the highest-level data structures in DynamoDB. They are where you store your data.&#x20;

Each table consists of items, and each item represents an individual data record.&#x20;

Tables are schema-less, meaning that items within a table do not need to have the same attributes, allowing flexibility in your data modeling.

### DynamoDB Features

<figure><img src="https://921544542-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FiRQTWHUNVZ5tIxQJXclF%2Fuploads%2F4yWAt1OUkDHV9F0uodls%2F97012dynamodb%20fts.png?alt=media&#x26;token=f2540057-fec9-4cc3-a25f-c6e1397befbf" alt=""><figcaption><p>Features</p></figcaption></figure>

### Data Models and Schema

DynamoDB is schema-less, and what does schema-less mean? it means that DynamoDB doesn’t require a schema to create a table, allowing you to define your data structure dynamically.&#x20;

It utilizes the concept of items (records) and attributes (fields) to store and retrieve data.

The structure of a DynamoDB table is also comprised of Primary Keys, Partition Keys, Sort Keys and Partitions

Basically keys work the same as it happens in JSON documents

```json5
{
   'EmployeeID': 101,
   'Company': 'Rose-Hill',
   'Username': 'Rose',
   'Name': 'Antony',
   'Sex': 'M'
}

```

### DynamoDB Use cases

1. Real-time Application

Require low-latency access to data.

Internet of Things (IoT) applications for managing device data.

Gaming applications for user profiles, leaderboards, and in-game items.

2. Session Management &  User Authentication

For web and mobile apps

3. Ad Tech Platform

For tracking user behavior and ad impressions.

4. Content Management Systems and catalogs

### DynamoDB Vs Others

<figure><img src="https://921544542-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FiRQTWHUNVZ5tIxQJXclF%2Fuploads%2FdO46wEna3jrxqSPj2tbU%2Fj04s284zrtgt02bw08a0.png?alt=media&#x26;token=3f25a067-b08e-4f21-b1e2-2a0399d34b59" alt=""><figcaption><p>Dynamo Vs Others</p></figcaption></figure>

### How Create DynamoDB in AWS

1. Sign in to the AWS Management Console and open the DynamoDB console.

<figure><img src="https://921544542-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FiRQTWHUNVZ5tIxQJXclF%2Fuploads%2FKzPFovJp330nti1KKLvp%2F64.png?alt=media&#x26;token=4c919362-ec9f-4c01-9edf-9a2e537ee066" alt=""><figcaption></figcaption></figure>

2. In the navigation pane on the left side of the console, choose **Dashboard**.

<figure><img src="https://921544542-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FiRQTWHUNVZ5tIxQJXclF%2Fuploads%2FUFcD57aFiknjO0QADdph%2F65.png?alt=media&#x26;token=64c9a532-6c08-47b3-886e-f4e363e616ef" alt=""><figcaption></figcaption></figure>

3. On the right side of the console, choose Create Table.

<figure><img src="https://921544542-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FiRQTWHUNVZ5tIxQJXclF%2Fuploads%2FlLZTvCwBI94D2aaHLwrw%2F66.png?alt=media&#x26;token=fbef2680-eab7-48ec-8de7-a012e6754195" alt=""><figcaption></figcaption></figure>

4. Fill in the table details as depicted below

<figure><img src="https://921544542-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FiRQTWHUNVZ5tIxQJXclF%2Fuploads%2FRxqEBrwTg9OuShBTWNH8%2F67.png?alt=media&#x26;token=7dbcc5ad-fd20-41c9-b1ba-e70ed5b66238" alt=""><figcaption></figcaption></figure>

5. After filling in the details click on Create:

<figure><img src="https://921544542-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FiRQTWHUNVZ5tIxQJXclF%2Fuploads%2Fgw1EMXFwh7DAJLsKvL2s%2F68.png?alt=media&#x26;token=b81373ae-1631-4a2e-9369-7317d3d05be1" alt=""><figcaption></figcaption></figure>

At this point your table is ready and you can start adding data into it.

<figure><img src="https://921544542-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FiRQTWHUNVZ5tIxQJXclF%2Fuploads%2FddhMgJbPXIMenOLEb5v1%2F69.png?alt=media&#x26;token=1e1235d1-1ed8-4460-b68e-12dd5e741e2d" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://devops-3.gitbook.io/devops/docs/module-4-aws/dynamodb.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
