• It is a fully managed NoSQL database service
  • It provides fast and predictable performance with seamless scalability.
  • Offload the administrative burdens of operating and scaling a distributed database
  • It also offers encryption at rest
  • Create database tables that can store and retrieve any amount of data
  • Serve any level of request traffic.
  • Scale up or down tables’ throughput capacity without downtime or performance degradation
  • Use the AWS Management Console to monitor resource utilization.
  • Also, provides on-demand backup capability with full backups of tables for long-term retention and archival.
  • tables, items, and attributes are the core components
  • A table is a collection of items
  • item is a collection of attributes.
  • primary keys are used to uniquely identify each item in a table
  • secondary indexes provide more querying flexibility
  • DynamoDB Streams capture data modification events in DynamoDB tables.

DynamoDB components

  • Tables
    • Similar to other database systems, DynamoDB stores data in tables.
    • A table is a collection of data
    • Example, see the example table called People, is listed below, to store personal contact information about friends, family, or anyone else of interest. You could also have a Cars table to store information about vehicles that people drive.
  • Items
    • Each table contains zero or more items
    • An item is a group of attributes that is uniquely identifiable among all of the other items.
    • In a People table, each item represents a person. For a Cars table, each item represents one vehicle.
    • Items are similar in many ways to rows, or tuples in other database systems.
    • There is no limit to the number of items you can store in a table.
  • Attributes
    • Each item is composed of one or more attributes.
    • It is a fundamental data element, and is not to be broken down any further.
    • For example, an item in a People table contains attributes called PersonID, LastName, FirstName, and so on.
    • Attributes are similar to fields or columns in other database systems.

The following diagram shows a table named People with some example items and attributes.

Note the following about the People table:

  • Each item in the table has a unique identifier, or primary key, that distinguishes the item from all of the others in the table. In the People table, the primary key consists of one attribute (PersonID).
  • Other than the primary key, the People table is schemaless, which means that neither the attributes nor their data types need to be defined beforehand. Each item can have its own distinct attributes.
  • Most of the attributes are scalar, which means that they can have only one value. Strings and numbers are common examples of scalars.
  • Some of the items have a nested attribute (Address). DynamoDB supports nested attributes up to 32 levels deep.

DynamoDB supports two different kinds of primary keys:

  • Partition key – A simple primary key, composed of one attribute known as the partition key. Partition key’s value is input to an internal hash function. The output from the hash function determines the partition (physical storage internal to DynamoDB) in which the item will be stored. In a table that has only a partition key, no two items can have the same partition key value. The People table has a simple primary key (PersonID) to access any item in the table directly by providing it.
  • Partition key and sort key –  Called as a composite primary key. Has two attributes – first is the partition key, and second is the sort key. Partition key value as input to an internal hash function. The output from the hash function determines the partition (physical storage internal to DynamoDB) in which the item will be stored. All items with the same partition key value are stored together, in sorted order by sort key value.

Secondary Indexes –

  • Can create one or more secondary indexes on a table.
  • Query the table using an alternate key by secondary index, instead of primary key.
  • DynamoDB doesn’t require index, but index give more flexibility during querying data.
  • With a secondary index on a table, read data from index similar as, from the table.

DynamoDB index types

  • Global secondary index – Partition key and sort key that can be different from those on the table.
  • Local secondary index –Same partition key as the table, but a different sort key.

DynamoDB supports eventually consistent and strongly consistent reads.

  • Eventually Consistent Reads – When you read data from a DynamoDB table, the response might not reflect the results of a recently completed write operation. The response might include some stale data. If you repeat read request after a short time, the response should return the latest data.
  • Strongly Consistent Reads – When you request a strongly consistent read, DynamoDB returns a response with the most up-to-date data, reflecting the updates from all prior write operations that were successful. A strongly consistent read might not be available if there is a network delay or outage. Consistent reads are not supported on global secondary indexes (GSI).
Menu