AWS Foundation DynamoDB Part 1
AWS Foundation DynamoDB Part 1
Amazon DynamoDB
1 NoSQL Databases
2 DynamoDB
3 Components
4 API
5 Provisioned Throughput
6 Partitions
• Provides high scalability and availability. Provides structured, semi-structured and non-structured
schemas.
• Types:
o Graph Database: A network database that uses edges and nodes to represent and store data. Neo4j, Titan etc.
o Key Value Store: Schema-less format, data stored as key value. Riak, DynamoDB.
o Column based: Each storage block contains data from only one column. Cassandra, HBase.
• Why NoSQL??
• DynamoDB automatically spreads the data and traffic for tables over a sufficient number of servers
to handle throughput and storage requirements.
• Data is stored on high performance SSDs and replicated across multiple AZs in a Region.
{
“EmpID” : 12345 ,
“EmpName” : “xyz” ,
“Address”
“cars” :[ :{
{“Building”
“name” :: “Toyota”
“Bldg-1” ,
, “models” : [ “Prius” , “Camry”
“Street” : ”40/1
,“Corolla”]Blvd”} , , “ZipCode” :
{654321
“name” : “Honda” , “models” : [ “Accord” , “Civic” ] } ,
{ “name” : “Jeep” }
} ]“Skills” : [ “AWS” , “Java” , “Oracle” ] ,
P a b
K
11 P Q
22 R S
P-1
• Eventual Consistency
• Strong Consistency
• “ProvisionedThroughputExceededException”.
• Data distribution using primary key only. In the case of composite primary key with partition and sort
key, data with same partition is always stored physically close together.
• Initial Partitions – A partition can support a maximum of 3000 RCU or 1000 WCU and a data capacity
of 10GB.
3000 RCU
1000 WCU
10 GB
• If the size per partition goes beyond 10GB or Provisioned throughputs are increased DynamoDB
doubles current no. of partitions.
• Rebalancing is done automatically by DynamoDB in the background, without any application impact
at all.
(8000/3000 = 3)
+
RCU=1600 RCU=1600
(1500/1000 = 2) WCU = 300 WCU = 300
=5
Copyright IntelliPaat, All rights
DynamoDB API
• DynamoDB operations has to be done by provided APIs
CreateTable – Create a new table. Can be used to create indexes as well.
DescribeTable – Returns information about tables.
ListTables – Returns all tables.
UpdateTable - Modifies the settings of a table or its indexes, creates or remove new indexes on a
table, or modifies DynamoDB Streams settings for a table.
DeleteTable – Removes table and its dependent objects.
PutItem – Writes a single item, primary key must be specified.
BatchWriteItem - Writes up to 25 items to a table.
GetItem – Retrieves a single item with Primary Key.
BatchGetItem – Retrieves up to 100 items from a table.
Query - Retrieves all of the items that have a specific partition key.
Scan - Retrieves all of the items in the specified table or index.
UpdateItem - Modifies one or more attributes in an item when Primary Key is provided.
DeleteItem – Deletes a single item with a specific Primary Key.