with Amazon DynamoDB

In this tutorial, you will learn how to create a simple table, add data, scan and query the data, delete data, and delete the table using the DynamoDB Console.  Everything done in this tutorial is free-tier eligible.

Using NoSQL with AWS Requires an Account

Create a Free Account in Minutes

AWS Free Tier offers 25 GB of storage, up to 200 million requests per month with Amazon DynamoDB.

View AWS Free Tier Details »

 

When you click here, the AWS management console will open in a new browser window, so you can keep this step-by-step guide open. When this screen loads, find DynamoDB under Databases and click to open the DynamoDB Console.

AWS Console Image

(click to zoom)

AWS Management Console_DynamoDB

a. In the DynamoDB console, click Create Table.

create-select-nosql1

(click to zoom)

create-select-nosql1

b.  We will use a music library as our use case for this tutorial.  In the Table name field, type “Music.”

create-select-nosql_a0

(click to zoom)

create-select-nosql_a0

c.  The Partition Key is used to spread data across partitions for scalability. It’s important to choose an attribute with a wide range of values and that is likely to have evenly distributed access patterns. Type “Artist” in the Partition Key field.

 

create-select-nosql_a1

(click to zoom)

create-select-nosql_a1

d. Since each artist may write many songs, you can enable easy sorting with a Sort Key. Check the Add sort key box. Type “SongTitle” in the Sort Key field.

We will accept the default settings for this example.

 

create-select-nosql_a2

(click to zoom)

create-select-nosql_a2

e. Now click Create. When the “Music” table is ready to use, it appears in in the table list with a checkbox.

Congratulations!  You've now created a NoSQL Table using Amazon Dynamo DB console.

 

create-select-nosql23

(click to zoom)

create-select-nosql23

a. Click the Items tab. Under the Items tab, click Create item.

create-select-nosql_a3

(click to zoom)

create-select-nosql_a3

b. In the data entry window, type the following:

  • For the “Artist” attribute, type “No One You Know”
  • For the “SongTitle” attribute, type “Call Me Today”
  • Click “Save” to save the item.
create-select-nosql9

(click to zoom)

create-select-nosql9

c. Repeat the process to add a few more items to your “Music” table:

  • Artist: No One You Know; SongTitle: My Dog Spot
  • Artist: No One You Know; SongTitle: Somewhere Down The Road
  • Artist: The Acme Band; SongTitle: Still in Love
  • Artist: The Acme Band; SongTitle: Look Out, World
create-select-nosql_a5

(click to zoom)

create-select-nosql_a5

a. Using the drop-down list in the dark gray banner above the items, change Scan to Query

create-select-nosql24

(click to zoom)

create-select-nosql24

b. You can use the console to query the Music table in various ways. For your first query, do the following:

  • In the “Artist” field, type “No One You Know”, then click Start search.  All songs performed by “No One You Know” are displayed.

Try another query:

  • In the “Artist” field, type “The Acme Band”, then click Start search.  All songs performed by “The Acme Band” are displayed.
create-select-nosql12

(click to zoom)

create-select-nosql12

c.Try another query, but this time narrow down the search results:

  • In the “Artist” field, type “The Acme Band”
  • In the “SongTitle” field, select “Begins with” from the drop-down list and type “S”
  • Click Start search.  Only “Still in Love” performed by “The Acme Band” is displayed.

 

create-select-nosql15

(click to zoom)

create-select-nosql15

Select your Query dropdown back to Scan.  

Click the checkbox next to “The Acme Band” and the selected item will become highlighted.  In the Actions Dropdown, select Delete.  You will be asked whether to delete the item.  Click Delete and your item is deleted.

create-select-nosql_a6

(click to zoom)

create-select-nosql_a6

You can easily delete a table from the Amazon DynamoDB console.  In fact, it is a best practice to delete tables you are no longer using so you don’t keep getting charged for them.

  • In the Amazon DynamoDB console, click the Actions dropdown and click  Delete table
  • A confirmation dialog appears; click the Delete button.

Note: By default, CloudWatch alarms for the table are also deleted. This process takes several seconds to complete.

create-select-nosql20

(click to zoom)

create-select-nosql20

You have created your first DynamoDB table, added items to your table, and then queried the table to find the items you wanted.  You also learned how to visually manage your DynamoDB tables and items through the AWS Management Console.

 

Now that you have learned to create, manage, and query tables and items from the management console, you can progress to the next tutorial where you will learn how to import large amounts of data, then quickly and easily find the information you need.  You’ll import a movie database to see how you can quickly find details about your favorite actors and characters.

Learn the Basics of DynamoDB Operations »

Yes
No