AWS : Dynamo DB : Developer : Section 22

 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

 

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

NoSQL serverless

DynamoDB Is serverless database . it is managed by AWS and it will scale for you. It is well integrated with AWS lamda and other AWS services . We will learn 

  • how do design a dynamo db table 
  • How to enable streams and how to ensure your Dynamodb table is fully secured

But if you add read replicas you are going to be limited to how many read replicas you can have .




How to choose a Primary key for Dynamo DB

You have two options for primary Key .


 

317. DynamoDB Basics Hands On

We start by creating a Table not a Database in a normal scenario

It is Create a Table Not Create Database .


Thats because the database is already created , so the only constraint you have is to create a Dynamo DB. so there is no provisioning of a database or so on and that makes it a server-less offering .

Table_Name : Users and then we have an option to choose Partition key and optionally a sort key


Here we have setting for the table . Here we have default table and customized settings .

With default setting we get the following


We chose to take customized settings .


we are going to disable auto scaling and we are going to provision two


disable auto scaling for write capacity 


Hit create table 


Click on the User Table 


click on View Items 


click create an Item


We need to define the partition Key for example .

You can create attributes by clicking attributes 


This can be used via a form or a JSON document


Create a Second Item 

If I create the same user id as before I will have a problem

Something very interesting will happen .


In RDBMS database it will mention that the coloumns are missing  but in here you can have just the what ever is possible


In Dynamo DB it is completely fine to add attributes over time. Dynamo DB is done at the region level.

318. DynamoDB WCU & RCU - Throughput




Exponential is the process of retrying your read / write when you receive Provisioned Throughtput Exceeded Exception and now you will have to retry the read / write this is called Exponential Backoff.

 


 Write Capacity Units are easy to understand . The complicated ones are read capacity .

 There are two kinds of read mode for DynamoDB 


Lets see how Dynamo DB works in the backend with partitions .

Partions copies of data that living on specific servers

When the application writes into the Dynamo DB it send some partitions key , some sort key perhaps too to the dynamo db database and all these data is going to go through an Hashing Algorithm to understand which partition to go to .

 If you take the example of the below diagram and take the partition key of 13 


ID_13 is going to go through this internal hash function of DynamoDB , so it is going to say anytime i see ID_13 it is going to go into partition -1


And if there is another ID_45 and goes via Hash Function and is redirected to Partition -2 


This is how your partition is going to get distributed. This is how your data gets distributed .


If you have something called the hard partition the data is always going to be the hard key . The data is always going to be the same partition .


Each partition is going to get 1 WCU AND 1RCU  -- for WCU and RCP is spread evenly across platforms. 

DynamoDB throttling .



319. DynamoDB WCU & RCU Hands
On

Lets see how we can define our RCU and WCU of our tables. 


If you take the users table for example . -- Additional Settings


Edit

 

The cool thing about Dynamo DB is we can switch between capacity modes .


On demand -- This is three times more expensive than Provisioned .

Provisiion mode has a capacity calculator




320. DynamoDB Basic APIs

In the exam you see the API calls in Dynamo DB are referred by their names . So if you want to write data

 


 


 


 


 

321. DynamoDB Basic APIs Hands On

 Scan

 


 Scan is going to scan the entire table .

322. DynamoDB Indexes (GSI + LSI)



323. DynamoDB Indexes (GSI + LSI) -
Hands On

Create table 



LSI have to be defined during table creation time and not after the creation of the table. But in GSI you can create it afterwards .

324. DynamoDB Optimistic Locking .



325. DynamoDB DAX


DAX and Elastic Cache can be used in combination with each other .


DAX cluster is not free 


327. DynamoDB Streams

Stream are like order list of items . The stream represents all the modifications over time .











Comments

Popular posts from this blog

AWS Data Replication

AWS SysOps