0% found this document useful (0 votes)
32 views

Dynamo DB Api

The document discusses DynamoDB data modeling and API. It explains that DynamoDB uses tables which are collections of items, similar to rows in a relational database. Items have a primary key and can have secondary indexes. The document provides examples and describes operations for creating, querying, and managing tables and data.

Uploaded by

Parv Agarwal
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
32 views

Dynamo DB Api

The document discusses DynamoDB data modeling and API. It explains that DynamoDB uses tables which are collections of items, similar to rows in a relational database. Items have a primary key and can have secondary indexes. The document provides examples and describes operations for creating, querying, and managing tables and data.

Uploaded by

Parv Agarwal
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 75

Dynamo DB – Data Model and API

pm jat @ daiict
Dynamo DB – Data Model
• Dynamo DB Table
• Meta information of a table
– Primary Key and “Secondary Indexes”
• Structure and meaning of “Primary Key” in Dynamo
• Primary Key of the dynamo table and “Key” in Key-Value stores
• The Primary Key is used for
– Uniquely identifying an item in a table
– data partitioning
– data ordering within a partition
– Performing search operation
• Define and alter a table “structure”

27-Oct-23 Dynamo DB – Data Model and API 2


DynamoDB Data Model
Correspondences with Relation DBs
• DynamoDB database has three
core components RDB DynamoDB
– Table, Item, Attributes Table Table
Row/Tuple Item
• Table is a collection of Items.
(distributed collection) Column/Attribute Attribute

• Correspondences with Relational Databases is shown in table here.


• Items are basically data objects. Name “Items” may be bit confusing, read this as
“data item” or “data record”
• Data Items are described by Attribute-Value pairs; can be in nested manner.

27-Oct-23 Dynamo DB – Data Model and API 3


Table “People”

Example Table
Note following
• Table named “People”
• Primary Key here is “Person ID”
• Other than the Primary Key the Table is “schema less”
– This means PK is the only thing needs to be defined
as schema of the table, and nothing else!

27-Oct-23 Dynamo DB – Data Model and API 4


Table “People”

Example Table
Note following
• Data objects (Items) are divided in two parts
– Key, and
– Value
• In this case Person ID is the key whereas rest of the
attribute values are data.
• Attributes in value part can be nested – for example
Address attribute has sub-attributes

27-Oct-23 Dynamo DB – Data Model and API 5


DynamoDB Data Model
• Data Items in Dynamo DB are schema-less.
• Key (and Index) information is only schema dynamo tables have.
• Items are identified by Keys (Called as Primary Key)
• We can have secondary indexes on a table to allow querying on other attributes
(than primary key).

27-Oct-23 Dynamo DB – Data Model and API 6


Primary Key in Dynamo DB
• “KEY” part of Key-Value maps to “Primary Key”
• Recall data access in Key-Value store is done based on Key and hence on
Primary Key: GET, PUT, DELETE, etc.
• Primary Key, optionally, has two parts
– “Partition Key” (called HASH key)
– “Clustering Key”, optional (called SORT key)
• “Partition-Key + Clustering Key” should be uniquely identifying a data item in the
table!
• Since Clustering Key is optional. When not specified, partition key alone is primary
key and uniquely identify a data item in the table

27-Oct-23 Dynamo DB – Data Model and API 7


Primary Key in Dynamo DB
• Partition Key is used for
Partition-Key (Hash Key)
data partition
optional
• Clustering or Sort Key is used

Sort-Key
for ordering data within a
partition
• When specified both Primary
Key said to be “Composite”

27-Oct-23 Dynamo DB – Data Model and API 8


https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/HowItWorks.Partitions.html
Table “Music”

Example Table
• Here is a Table with Composite Primary Key
• Table Name: Music
• Primary Key:
Partition Key: Artist
Clustering Key: Song Title
• Note a operation enhancement here in Dynamo DB
• We can perform GET based on part of Primary Key
– By specifying only “Artists Name”
– May also specify some filter on “Song Title”

27-Oct-23 Dynamo DB – Data Model and API 9


Secondary Indexes in DynamoDB
• Secondary Index:
– Index on attributes other than primary key.
– Secondary index is stored external to table, that is mapping information is
external to the table!
• Secondary Index could also be partitioned on several nodes
• Its index entries basically stores “Index Primary Key (Index-Key)” to “Table Primary
Key (Table-Key)”
• “Access-Key” of secondary index again has
– “Partition Key” , and
– Sort Key [optional]

27-Oct-23 Dynamo DB – Data Model and API 10


Secondary Indexes in DynamoDB
• A secondary index is created to query the data through “another attribute(s)”
• Example: Consider Music Table; Let us have secondary index based on “Gener” as
Partition Key, and “Album Title” as sort Key. This means
– Index entries are partitioned on “Gener” and sorted within partition based on
“Album Title”
• On having this secondary index, we can have look-up based on another key “Genre”
and “Album Title”

27-Oct-23 Dynamo DB – Data Model and API 11


Secondary Index: “GenreAlbumTitle” Table “Music”

• Secondary Index stores


“Index (Primary) Key” to
“Table (Primary) Key”

27-Oct-23 Dynamo DB – Data Model and API 12


Secondary Index:
DynamoDB “GenreAlbumTitle”

Secondary Indexes
• “Index keys” are additional “search keys”
• “Index values” are keys of data records “Items”
• Indexes belong to a table
• DynamoDB maintains indexes automatically –
as we add, update, or delete data

27-Oct-23 Dynamo DB – Data Model and API 13


Dynamo DB Data Model - summarize
• Dynamo uses a concept of Table.
• Table is “Collection of Data Items”, dynamo calls it as Item only
• “Item” has no Schema, however Item do have Primary Key
• Primary Key consists of
– Partition Key (HASH-KEY)
– Sort Key (RANGE-KEY) [optional]
• Partition Key (Hash Key) is used to partition the data items (by applying hash
function
• Sort key is used to order data within a partition
• Table is schema less (except having Key information)

27-Oct-23 Dynamo DB – Data Model and API 14


Dynamo DB API
DynamoDB Provides following operations
• Data Definition: To create and maintain tables, and indexes
• PUT: to write data records into table
• GET: read data record(s) from tables
• DELETE data records from tables (on Primary Key)

27-Oct-23 Dynamo DB – Data Model and API 15


Dynamo DB API
DynamoDB Provides following operations
• Data Definition: To create and maintain tables, and indexes
• PUT: to write data records into table
• GET: read data record(s) from tables
• DELETE data records from tables (on Primary Key)

27-Oct-23 Dynamo DB – Data Model and API 16


Table Operations (Data Definition)
• Create Table – Creates a new table.
– Specify Primary Key
– Optionally, also specify “secondary indexes”, and so!
• Describe Table– Returns information about a table, such as its primary key schema,
throughput settings, and index information.
• List Tables – Returns the names of all your tables in a list.
• Update Table – Modifies the settings of a table or its indexes, creates or removes
new indexes on a table, and so forth.
• Delete Table – Removes a table and all of its dependent objects from DynamoDB.

27-Oct-23 Dynamo DB – Data Model and API 17


DynamoDB API – CREATE TABLE
• Before performing any operation, you require creating table.
• Parameters to create table are
– Table Name
– Definition of some attributes: attributes that are part of Keys, and Indexes.
– Attribute Definition includes Attribute Name and Data Type
– Key Information
– Storage Provisioning Information “Provisioned Throughput Capacity”

27-Oct-23 Dynamo DB – Data Model and API 18


DynamoDB Data Types
• DynamoDB supports many different data types for attributes within a table. They
can be categorized as follows:
• Scalar Types – A scalar type can represent exactly one value. The scalar types are
Number, String, Binary, Boolean, and Null.
• Document Types – A document type can represent a complex structure with nested
attributes, such as you would find in a JSON document. The document types are list
and map.
• Set Types – A set type can represent multiple scalar values. The set types are string
set, number set, and binary set.

27-Oct-23 Dynamo DB – Data Model and API 19


Dynamo DB API – CREATE TABLE
• Here is an example: creating “Music” table
• Attributes: Artist (String), Song Title (String)
• Partition Key: Artist (HASH implies “Partition”),
• Sort Key: Song Title (RANGE implies Sort)

27-Oct-23 Dynamo DB – Data Model and API 20


Important Note!
• You might find lots of code here but that does not mean you require knowing the
syntax
• Only the expectation is understand
– the meaning of operations
– Parameters to it
– Outcome or “return” as applicable!

27-Oct-23 Dynamo DB – Data Model and API 21


DynamoDB data types [2]
Scalar Types:

27-Oct-23 Dynamo DB – Data Model and API 22


DynamoDB data types [2]
Set Types and Document Types (List and Map):

27-Oct-23 Dynamo DB – Data Model and API 23


ALTER Table and Drop Table
ALTER Table
• Allows making modifications in Table schema
• Mostly you provide same inputs
– Attribute List
– Index Definitions
– Provisioning information
• We can not Change Keys
Delete Table
• Drops a table

27-Oct-23 Dynamo DB – Data Model and API 24


DynamoDB API - Commands
• PUT (write into table), provide following operations
– put-item (KV PUT a single item)
– batch-write-item (PUT multiple KV pairs)
• GET (read from a table), provide following operations
– get-item (KV-GET for a single key)
– batch-get-item (KV-GET for a multiple keys)
– query (search by only “partition key”)
– scan (sequential scan)
– GET through a “Secondary Index”
• DELETE (for a key, or a key-list)

27-Oct-23 Dynamo DB – Data Model and API 25


DynamoDB API – WRITE
• put‐item – Writes a single item to a table. While writing it is necessary specifying
primary key-attributes of the item to be written.
• Of course we can specify additional attributes (any attribute; need not be same in all
data items in a table). Recall the schema-less-ness
• batch‐write‐item – Writes up to 25 items to a table.
• Note: Read/write operations have batch variations. The batch variations are more
efficient than calling single item operation multiple times because, the application
only needs a single network round trip to read/write the items.

https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/HowItWorks.API.html

27-Oct-23 Dynamo DB – Data Model and API 26


“put‐item” example
OPTIONAL
• Parameters:
– Table name
– Item to be added in JSON format

27-Oct-23 Dynamo DB – Data Model and API 27


“put‐item” example
Read data-item from a file for writing into table OPTIONAL

item.json

https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/HowItWorks.API.html

27-Oct-23 Dynamo DB – Data Model and API 28


“batch‐write‐item” example
OPTIONAL
request‐items.json

27-Oct-23 Dynamo DB – Data Model and API 29


https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/HowItWorks.API.html
DynamoDB API – Update
• Update‐Item – Modifies one or more attributes in an item.
• We must specify the primary key for the item that we want to modify.
• We can add new attributes and modify or remove existing attributes.
• We can also perform conditional updates, so that the update is only successful when
a user-defined condition is met.

https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/HowItWorks.API.html
27-Oct-23 Dynamo DB – Data Model and API 30
“update‐item” example
Parameters: (1) Key, (2) Update expressions, (3) new values
OPTIONAL

https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/HowItWorks.API.html
27-Oct-23 Dynamo DB – Data Model and API 31
“update‐item” example
OPTIONAL
• Specify Key and Values from a JSON file

key.json

expression‐attribute‐values.json

27-Oct-23 Dynamo DB – Data Model and API 32


https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/HowItWorks.API.html
DynamoDB API - Read
• get‐item – Retrieves a single item from a table. Require specifying the primary key for the
item that is to be read.
• We can retrieve the entire item, or a subset of its attributes.
• batch‐get‐item – Retrieves up to 100 items from one or more tables.
• query – querying based on Partition Key (and optionally on sort key, if applicable)
– Query can also be based on of secondary index: its partition key (and optionally sort
key).
– We can also apply filtering and other operations on result of a query!
• scan – Retrieves all items in the specified table or index.
– Optionally, we can apply a filtering condition to return items that meet specified criteria.

27-Oct-23 Dynamo DB – Data Model and API 33


“get‐item” example
INPUT: KEY OPTIONAL

Specify projection

https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/WorkingWithItems.html
27-Oct-23 Dynamo DB – Data Model and API 34
“batch-get‐item” example
OPTIONAL
//table‐name
request‐items.json
//key values

Two key values have been specified.

https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/WorkingWithItems.html
27-Oct-23 Dynamo DB – Data Model and API 35
“query” example
• Query (also) allows querying based on Key only
• We specify “Key-Expression”
• In the example below:
– Table: Thread. Partition Key: ForumName
– Returns all of the items for given value for given partition key.

https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Query.html
27-Oct-23 Dynamo DB – Data Model and API 36
“query” example
OPTIONAL
• Table: Thread. Partition Key: Forum Name
• Returns all of the items with given value for given partition key value

values.json

https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Query.html
27-Oct-23 Dynamo DB – Data Model and API 37
Process “query” Results
• After query has been retrieved based on Partition Key (and Sort Key), results of that
query can be further processed
– Filtering
– Counting
– Limiting the items in results set (LIMIT parameter)
– Paginating the results
• Note that a query operation can retrieve a maximum of
1 MB of data (before the filter)

27-Oct-23 Dynamo DB – Data Model and API 38


Filter Expressions for Query OPTIONAL
• Filter can be on any attribute; here is a query on partition key, and sort key.

Partition-key Sort-key

values.json

https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Query.html
27-Oct-23 Dynamo DB – Data Model and API 39
Limiting the Number of Items in the Result Set

• The Query operation allows us limit the number of items that it reads.
• To do this, set the Limit parameter to the maximum number of items that you want.
• Note that the filter is applied after limit.

https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Query.html

27-Oct-23 Dynamo DB – Data Model and API 40


Scanning a Table
• Scan retrieves all items in the specified table or index.
• Scans whole table and allow doing
– Filtering
– Counting
– Limiting the items in results set (LIMIT parameter)
– Paginating the results
• Note that a scan can also retrieve a maximum of 1 MB of data
• We can also specify projecting attributes

27-Oct-23 Dynamo DB – Data Model and API 41


Scan Examples
OPTIONAL

https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Query.html
27-Oct-23 Dynamo DB – Data Model and API 42
Scan Examples
OPTIONAL

27-Oct-23 Dynamo DB – Data Model and API


https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Query.html 43
Parallelizing the “Scan” operation

• By Default Sequential
• Scan operation allows specifying parameter “TotalSegments” indicating a parallel
number of segments to be executed

27-Oct-23 Dynamo DB – Data Model and API 44


Query and Scan operations
• Query:
– Can be only on Key
– However, we may only specify partition key, sort-key is optional
– Filter can be applied on any attribute
• Scan is complete scan of a table
– Filter can be applied on any attribute

27-Oct-23 Dynamo DB – Data Model and API 45


“delete‐item” operation
• Removes specified data items.
• Parameters
– Table name
– Key-Value(s) for items to be delted

27-Oct-23 Dynamo DB – Data Model and API 46


“delete‐item” example OPTIONAL

key.json

27-Oct-23 Dynamo DB – Data Model and API 47


DynamoDB Operations - summarize
• PUT operations (Primary Key based)
– Parameters: <Key, Value> pair or List of <Key, Value> pairs if bulk load
– put‐item(K,V), batch‐write‐item (LIST(<K‐V> , Update‐Item (K,
update‐instructions)
• GET operations (Primary Key based)
– Parameters: Key (values for Partition Key and Sort Key) or Set of Keys.
– Returns: Data Item object, or List of Data Items
– get‐item (KEY) , batch‐get‐item (KEY‐LIST)

27-Oct-23 Dynamo DB – Data Model and API 48


DynamoDB Operations - summarize
• QUERY (Partition Key based)
– Parameters: Partition Key
– Returns: Data Item object, or List of Data Items matching the specified Partition
Key value.
– Result can be further Filtered
• SCAN
– Scans full table.
– Returns: List of all Data Items.
– Result can be further Filtered.
• Returned the results can be sorted in ascending or descending order

27-Oct-23 Dynamo DB – Data Model and API 49


Dynamo Application Example

27-Oct-23 Dynamo DB – Data Model and API 50


Dynamo DB – Application Example
• Consider table “GameScore” with “UserID” as Partition Key and “Game Title” as Sort
Key

27-Oct-23 Dynamo DB – Data Model and API


https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Query.html 51
Dynamo DB – Application Example

Try Figuring out solutions for following queries on Table “GameScores”


Partition-Key: “UserID”. Sort-Key: “Game Title” as Sort
• Q#1: What is the score of user id “103” in Game “Galaxy Invaders”?
• Q#2: What are the top 3 games of user id “103”?
• Q#3: What is the top score ever recorded for the game “Meteor Blasters”?
• Q#4: Which user has the highest score for Galaxy Invaders?
• Q#5: What is the highest ratio of wins vs. losses?

27-Oct-23 Dynamo DB – Data Model and API 52


Q#1: What is the score of user id “103” in Game
“Galaxy Invaders”?

27-Oct-23 Dynamo DB – Data Model and API 53


Q#1: What is the score of user id “103” in Game
“Galaxy Invaders”?

• Use Primary Index!


• Use “Get-Item” with inputs of
27-Oct-23 UserID (PartitionDynamo
Key)=103,
DB – Dataand
ModelGameTitle
and API (Sort Key) = “Galaxy Invaders” 54
Q#2: What are the top 3 games of user id “103”?

27-Oct-23 Dynamo DB – Data Model and API 55


Q#2: What are the top 3 games of user id “103”?

• Use Primary Index!


• Use “Query” with the input of User-ID=103, Sort on TopScore, Limit response to 3
27-Oct-23 Dynamo DB – Data Model and API 56
Q#3:What is the top score ever recorded for the
game “Meteor Blasters”

27-Oct-23 Dynamo DB – Data Model and API 57


Table: GameScore

• Query Q03 can be better


answered if we have
secondary Index on
“Game Title” (Partition-Key),
and “Top Score” (Sort-Key)!
• In the absence of an index the
table would require a SCAN!
• The diagram here sketches the
index!

GameTitle Index

27-Oct-23 Dynamo DB – Data Model and API 58


Q#3:What is the top score ever recorded
for the game “Meteor Blasters”

• Use Global Secondary Index “GameTitleInex”


• Use Query with input GameTitle=“Meteor Blasters”, and Limit response to 1.
• Project: Top Score
27-Oct-23 Dynamo DB – Data Model and API 59
Q#4:Which user has the highest score
for Galaxy Invaders?

27-Oct-23 Dynamo DB – Data Model and API 60


Q#4:Which user has the highest score
for Galaxy Invaders?

• Use Global Secondary Index “GameTitleInex”


• Use Query with input GameTitle=“Galaxy Invaders”, First Record would refer
the highest score. Corresponding User ID is what we are looking for; therefore
27-Oct-23• Project: User ID Dynamo DB – Data Model and API 61
Q#5:What is the highest ratio of wins
vs. losses?

27-Oct-23 Dynamo DB – Data Model and API 62


Q#5:What is the highest ratio of wins
vs. losses?

• No index can be used here


• Option is SCAN only!
27-Oct-23 Dynamo DB – Data Model and API 63
More on Secondary Indexes in Dynamo DB
• Dynamo has two types of Secondary indexes:
– Global Secondary Index, and
– Local Secondary Index
• Global secondary index has different set of partition key and a sort key that can be
different from those on the base table, where as
• Local secondary index has the same partition key as the base table, but a different
sort key.
• They are local in the sense that they are local within a partition; only the difference
is on sort key, therefore their search can not go beyond partition (local)

27-Oct-23 Dynamo DB – Data Model and API 64


CREATING “Secondary Index” for a table
• A typical characteristics of secondary indexes in dynamo-db is that they can have
additional attributes (other than primary key of the table).
• In secondary index, we specify what is to be stored in the index. It can be one of the
following:
– KEYS_ONLY
– INCLUDE – we specify attributes that are to be included
– ALL– all attributes are copied in the index too (in this case index in duplication of
whole table with different search-key)

27-Oct-23 Dynamo DB – Data Model and API 65


CREATE Table with GSI OPTIONAL

27-Oct-23 Dynamo DB – Data Model and API 66


https://awscli.amazonaws.com/v2/documentation/api/latest/reference/dynamodb/create-table.html#examples
CREATE Table with LSI OPTIONAL

https://awscli.amazonaws.com/v2/documentation/api/latest/reference/dynamodb/create-table.html#examples
27-Oct-23 Dynamo DB – Data Model and API 67
Add GSI through UPDATE TABLE OPTIONAL

27-Oct-23 Dynamo DB – Data Model and API 68


https://awscli.amazonaws.com/v2/documentation/api/latest/reference/dynamodb/update-table.html
Example Secondary Index with more attributes

27-Oct-23 Dynamo DB – Data Model and API 69


Querying through GSI
• We can retrieve items from table through GSI using the Query and Scan operations
only.
– GetItem operations can't be used on GSI
• Parameters to “Query” through GSI are
– Name of the index
– Name of the base table
– Search criteria on index
– The attributes to be returned in the query results
– returned the results can be sorted in ascending or descending order.

https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/GSI.html
27-Oct-23 Dynamo DB – Data Model and API 70
Example: Query through GSI OPTIONAL
• Returns User, TopScore for game “Meteor Blasters”. Searching is
done using GSI “GameTitleInex”!
aws dynamodb query \
‐‐table‐name GameScores \
‐‐index‐name GameTitleIndex \
‐‐key‐condition‐expression "GameTitle=:v_title" \
‐‐expression‐attribute‐values '{
":v_title": {"S": "Meteor Blasters"}
}' \
‐‐projection‐expression "UserId, TopScore"

https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/GSI.html
27-Oct-23 Dynamo DB – Data Model and API 71
Tuning Consistency in Dynamo DB
• Recall Dynamo DB prefers Availability over consistency
• Dynamo API does not allow users to control R and W but allows specifying the
desired consistency level while doing READ operations.
• Provides the following two options
– “eventually consistent read”; which is basically weaker consistency’
– “strongly consistent reads”
• Dynamo DB uses eventually consistent reads unless we specify otherwise.
• Read operations (such as GetItem, Query, and Scan) provide a
ConsistentRead parameter. If you set this parameter to true,
DynamoDB uses strongly consistent reads during the operation.

https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/HowItWorks.ReadConsistency.html
27-Oct-23 Dynamo DB – Data Model and API 72
Consistency in Dynamo DB
• Eventually Consistent Reads:
– When we read data from a Dynamo DB table, the response might not reflect the
results of a recently completed write operation.
– The response might include some stale data.
– If you repeat your read request after a short time, the response should return
the latest data.
• Strongly Consistent Reads:
– When you request a strongly consistent read, Dynamo DB returns a response
with the most up-to-date data, reflecting the updates from all prior write
operations that were successful.
https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/HowItWorks.ReadConsistency.html

27-Oct-23 Dynamo DB – Data Model and API 73


Consistency in Dynamo DB
• It is worthwhile to note that “Strong Consistency” comes with the cost:
– Strongly consistent reads may have higher latency than eventually consistent
reads.
– A strongly consistent read might not be available if there is a network delay or
outage. In this case, Dynamo DB may return a server error (HTTP 500).
– Strongly consistent reads are not supported on global secondary indexes.
– Strongly consistent reads may use “more resources”

https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/HowItWorks.ReadConsistency.html

27-Oct-23 Dynamo DB – Data Model and API 74


References/Further Readings
[1] DeCandia, Giuseppe, et al. "Dynamo: Amazon's highly available key-value store." ACM SIGOPS
operating systems review 41.6 (2007): 205-220.
[2] Dynamo DB Documentation pages, beginning from
https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Introduction.html
[3] https://www.dynamodbguide.com/what-is-dynamo-db

27-Oct-23 Dynamo DB – Data Model and API 75

You might also like