Getting Started with AWS

Create and Manage a Nonrelational Database

with Amazon DynamoDB

Module 1: Application Background

To get started, you will explore the tutorial prerequisites.

Overview

Imagine that you are building an online bookstore application. Your bookstore has a large inventory of books that are stored in your warehouse to be sold to customers. The application must show users the books that are available for sale as well as some basic information about the book, such as its author.

The application needs to retrieve a specific book by its title and author so that a user can drill in for more detail when looking at a book. Furthermore, your application should allow users to browse all books in a particular category, such as history or biography, to allow for discoverability of interesting books.

Finally, you may carry different formats of a book, such as hardcover, paperback, or audiobook. Your application should store the formats you have in stock for a book with a mapping to the item number in your inventory system. Your application should allow these formats to be updated over time, as you may add or remove formats for a book.

In the modules in this tutorial, you learn how to model a DynamoDB table to accommodate these application needs.

In order to complete this tutorial, you need an AWS account and access to create AWS Identity and Access Management (IAM), Amazon DynamoDB, and AWS Cloud9 resources in that account. The step-by-step guide in this tutorial explains how to set up all prerequisites.

 Time to Complete

15 minutes

Implementation

  • Create an AWS account

    Use a personal account or create a new AWS account for this tutorial rather than using an organization’s account to ensure that you have full access to the necessary services and do not leave behind any resources from the tutorial.

  • Set up your AWS Cloud9 IDE

    AWS Cloud9 is a cloud-based integrated development environment (IDE) that lets you write, run, and debug code with just a browser. AWS Cloud9 includes a code editor, debugger, and terminal. It also comes prepackaged with essential tools for popular programming languages and the AWS Command Line Interface (CLI) preinstalled so that you don’t have to install files or configure your laptop for this lab. Your AWS Cloud9 environment will have access to the same AWS resources as the user with which you signed in to the AWS Management Console.

    To set up your AWS Cloud9 development environment:

    1. Navigate to the AWS Management Console, choose Services at the top of the page, and then choose Cloud9 under Developer Tools.
    2. Choose Create environment.
    3. Type DynamoDB Deep Dive in the Name box. Optionally type a  Description.
    4. Choose Next step.
    5. Leave the Environment settings at their defaults to create a new t2.micro EC2 instance, which will be hibernated after 30 minutes of inactivity.
    6. Choose Next step.
    7. Review the environment name and settings, and choose Create environment. Your environment will be provisioned and prepared after several minutes.
    8. Once ready, your IDE will open to a welcome screen.

    You should now see your AWS Cloud9 environment. There are three areas of the AWS Cloud9 screen to know, as illustrated in the following screenshot:

    • File explorer: On the left side of the screen, this shows a list of the files in your directory.
    • File editor: On the upper right portion of your screen, this is where you view and edit files that you’ve selected in the file explorer.
    • Terminal: On the lower right portion of the screen, this is where you run commands to execute code samples.
    AWS Cloud9 Console
  • Download the supporting code

    In these modules, you use Python scripts to interact with the DynamoDB API.

    Run the following commands in your AWS Cloud9 terminal to download the scripts and install the application dependencies:

    1. Download and unpack the module code by running the following command in the AWS Cloud9 terminal

    curl -sL https://s3.amazonaws.com/ddb-deep-dive/dynamodb.tar | tar -xv
    

    2. To install Boto 3, run the following command in the AWS Cloud9 terminal.

    sudo pip install boto3
    

    You are now ready to start this tutorial. In the first module you insert items into and retrieve items from your DynamoDB table.

Was this module helpful?

Thank you
Please let us know what you liked.
Close
Sorry to disappoint you
Is something out-of-date, confusing or inaccurate? Please help us improve this tutorial by providing feedback.
Close

Inserting and Retrieving Data