DynamoDB NoSQL key value and document database

  1. AWS DynamoDB
    1. A NoSQL database providing single digit millisecond latency
    2. Supports document and key value storage
    3. Fully managed by AWS, highly redundant and available and scalable
    4. Runs across 3 different geographically separate locations so its highly redundant
  2. Table contains Items (rows). Items have attributes (key – value)
  3. Primary Key
    1. Two types of primary key
      1. Partition Key (Hash Key)  will help determine the physical location of data.
      2. Composite key:  Partition Key (Hash Key) & Sort Key (Range key – e.g date)
    2. If two data points have same partition key (same location) it should have a different sort key, and they will be stored together on single location.
  4. Secondary Indexes: Secondary indexes allow you to perform queries on attributes that are not part of the table’s primary key. Note that global secondary index read and write capacity settings are separate from those of the table, and will incur additional costs.
    1. Local Secondary Index – Same Partition Key + Different Sort Key ( can only be created while creating the table, cannot be added/removed or modified later)
    2.  Global Secondary Index – Different Partition Key + Different Sort Key ( can be created during the table creation or can be added later or removed / modified later)
  5. Amazon DynamoDB synchronously replicates data across three facilities in an AWS Region, giving you high availability and data durability.
  6.  Supports
    1. Eventually Consistent Reads
      1. It may take 1 second before the reads return what has been written, but it will be eventually (after 1 sec) consistent
      2. Best price performance
    2. Strongly consistent reads
      1. Read returns all writes that received a “successful write” response before the read is sent
      2. If you need all your reads to be consistent with all writes (even that happened less than a second before) you will choose this model
  7. Pricing is based reads/writes/storage only. Not by CPU usage or data transfer
    1. Read throughput  0.000xxx $ per hour for every 40 units
    2. Write throughput  0.000xxx $ per hour for every 10 units
    3. Writes are 5X expensive than reads
    4. Storage Cost 0.25$ per Gb/month
    5. at the time of creating table choose
      1. Provisioned Read/Write capacity units
      2. Reserved Read/Write capacity units with 1 or 3 year contracts help you reduce costs
  8. Push button scaling
    1. By simply changing RCU/WCU inside the console on a table’s capacity tab
    2. Not possible in RDS since scaling up involves some downtime in RDS
  9. DynamoDB queries
    1. Query operation finds item in a table using only primary key attribute values, must provide partition attribute name and the value to search for
    2. you can optionally provide a sort key attribute name and value to refine search result
    3. By default Query returns all the data attributes for those items with specified primary keys. You can further use ProjectionExpression parameter to only return a selected attributes.
    4. Query results are always sorted by the sort key (ascending for both numbers and string by default). To reverse the sort order set the ScanIndexForward parameter to false
    5. By Default Queries are going to be Eventually consistent but can be changed to StronglyConsistent.
  10. DynamoDB scans
    1. Scan operation examines every item.
    2. by default Scan returns all the data attributes but we could use ProjectionExpression parameter to only return a selected attributes.
    3. Query operation is more efficient than scan operation. Scan operations are less efficient than other operations in DynamoDB.
    4. A Scan operation always scans the entire table or secondary index, then filters out values to provide the desired result, essentially adding the extra step of removing data from the result set.
    5. Because a Scan operation reads an entire page (by default, 1 MB), you can reduce the impact of the scan operation by setting a smaller page size.
  11. DynamoDB Streams
    1. captures a time-ordered sequence of item-level modifications in any DynamoDB table,
    2. stores this information in a log for up to 24 hours. Applications can access this log and view the data items as they appeared before and after they were modified, in near real time.
    3. DynamoDB stream is an ordered flow of information about changes to items in an Amazon DynamoDB table.
    4. When you enable a stream on a table, DynamoDB captures information about every modification to data items in the table.
    5. use to capture any kinda modification to the dynamo db table, Lambda can capture events and push notifications thru SNS
    6. Table can be exported to csv (either select all or few items )
  12. Encryption at rest can be enabled only when you are creating a new DynamoDB table. After encryption at rest is enabled, it can’t be disabled. Uses AWS KMS for key.
  13. Point-in-time recovery provides continuous backups of DynamoDB table data. Once enabled, DynamoDB maintains continuous backups of your table for the last 35 days.
  14. TTL is a mechanism to set a specific timestamp for expiring items from your table. The timestamp should be expressed as an attribute on the items in the table. The attribute should be a Number data type containing time in epoch format. Once the timestamp expires, the corresponding item is deleted from the table in the background.
<<< Relational Database Service (RDS)Redshift >>>
Copyright 2005-2016 KnowledgeHills. Privacy Policy. Contact .