Monday 16 May 2022

AWS Dynamo DB


 


DynamoDB:
  • provided and fully managed by AWS
  • highly scalable DB
  • low-latency access
    • single digit millisecond latency
  • high availability
    • data is replicated across multiple regions 
  • NoSQL DB
    • Data is stored in the form of key-value pairs and documents
    • schema-less DB that only requires a table name and primary key
      • table's primary key is made up of one or two attributes that uniquely identify items, partition the data and sort data within each partition

NoSQL DB Example: 
We want to store info about mobile phones. Each mobile phone (item) has attributes like Manufacturer, Model, Year, IMEI etc...This data can be represented as:


{
    "Manufacturer": "Samsung",
    "Model": "S80",
    "Year": 2017,
    "IMEI": 45243582345234632048432
}

{
    "Manufacturer": "Xiaomi",
    "Model": "X1",
    "Year": 2020,
    "IMEI": 75564582345234632048445
}

Each item can be uniquely identified by its IMEI and so this attribute is used as Primary Key. When adding new items it is mandatory to provide the value for their primary key while the other attributes are optional and can have a null value.

Provisioning DynamoDB using AWS Management Console

After logging in into AWS Management Console, go to Services >> Database >> DynamoDB and click on "Create table" button. This opens Create DynamoDB Table page where we can type in:
  • Table name e.g. mobile_phones
  • Primary key
    • can be of type string, binary or number
    • e.g. imei (number type)
Once we press "Create" button we get to mobile_phones page which contains all details about this table in the form of multiple tabs:
  • Overview
  • Items
    • Click on "Create item" button opens a modal dialog where we need to specify the value for the primary key (imei in our case). We can then perform Append/Insert/Remove action with new/existing items. Only specifying the value of primary key is mandatory. We don't need to specify values for any other attributes.
    • We can search (Scan) the items by specifying the filter (by clicking on the "Add filter")
  • Metrics
  • Alarms
  • Capacity
  • Indexes
  • Global Tables
  • Backups
  • Contributor Insights
  • Triggers
  • Access Control
  • Tags

No comments: