Step 5. Create the DynamoDB data model - AWS Prescriptive Guidance

Step 5. Create the DynamoDB data model

Objective

  • Create the DynamoDB data model.

Process

  • Database engineer identifies how many tables will be required for each use case. We recommend maintaining as few tables as possible in a DynamoDB application.

  • Based on the most common access patterns, identify the primary key that can be one of two types: a primary key with a partition key that identifies data, or a primary key with a partition key and a sort key. A sort key is a secondary key for grouping and organizing data so it can be queried within a partition efficiently. You can use sort keys to define hierarchical relationships in your data that you can query at any level of the hierarchy (see blog post).

    • Partition key design

      • Define the partition key and evaluate its distribution.

      • Identify the need for write sharding to distribute workloads evenly.

    • Sort key design

      • Identify the sort key.

      • Identify the need for a composite sort key.

      • Identify the need for version control.

  • Based on the access patterns, identify the secondary indexes to satisfy the query requirements.

  • Database engineer determines whether the data will include large items. If so, they design the solution by using compression or by storing data in Amazon Simple Storage Service (Amazon S3).

  • Database engineer determines whether time series data will be needed. If so, they use the time series design pattern to model the data.

  • Database engineer determines whether the ER model includes many-to-many relationships. If so, they use an adjacency list design pattern to model the data.

Tools and resources

RACI

Business user Business analyst Solutions architect Database engineer Application developer DevOps engineer

I

I

I

R/A

Outputs

  • DynamoDB table schema that satisfies your access patterns and requirements

Example

The following screenshot shows NoSQL Workbench.

DynamoDB table schema