Modeling Game Player Data

with Amazon DynamoDB

Introduction: Modeling Game Player Data with Amazon DynamoDB

Follow step-by-step instructions to learn advanced data modeling patterns.

Overview

In this lab, you learn advanced data modeling patterns in Amazon DynamoDB. When using DynamoDB, it is important to consider how you will access your data (your access patterns) before you model your data. We walk through an example multiplayer game, discuss the access patterns in the game, and show how to design a DynamoDB table to handle the access patterns by using secondary indexes and transactions.

This lab assumes familiarity with basic DynamoDB concepts such as tables, items, primary keys, and secondary indexes. If you are unfamiliar with these concepts, see our lab about how to Create and Manage a Nonrelational Database with Amazon DynamoDB.

Why use DynamoDB for a game?

DynamoDB is a popular database service for games because it is designed for high-scale use cases where consistent performance is critical as an application grows.

Some of the key reasons to use DynamoDB for your game are:

  • Scalability: DynamoDB scales to more than 100 TB with no performance degradation.
  • A simple REST-based API: DynamoDB is accessible over HTTP(S) and uses AWS Identity and Access Management (IAM) for authentication.
  • Fully managed: You don’t need to manage servers and apply patches to infrastructure. DynamoDB handles upgrades, backups, and other administrative tasks so that you can focus on developing your game.

 AWS Experience

Intermediate

 Time to Complete

120 minutes

 Cost to Complete

Less than $2 (assuming all services are running for 2 hours)*

 Tutorial Prereqs

Technologies used:
  • Active AWS Account**
  • Browser: AWS recommends Chrome
  • Amazon DynamoDB
  • Amazon Cloud9 
  • AWS SDK for Python (Boto3)
 
*This estimate assumes you follow the recommended configurations throughout the tutorial and terminate all resources within 2 hours.
**Accounts that have been created within the last 24 hours might not yet have access to the resources required for this project.

Modules

This tutorial is divided into five short modules. You must complete each module in order before moving on to the next one.

  1. Background and Setup (20 minutes): Learn how to model your DynamoDB table to handle your application’s access patterns
  2. Plan your Data Model (20 minutes): Build your entity-relationship diagram and map out our access patterns up front
  3. Core Usage: User Profiles and Games (20 minutes): Design the primary key for the DynamoDB table and enable the core access patterns
  4. Design Game Access Patterns (40 minutes): Use a global secondary index to find open games
  5. Clean up and Next Steps (20 minutes): Clean up the resources created in this lab

Background and Setup