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. DynamoDB is a fully managed NoSQL database that supports both document and key-value store models. Its flexible data model, reliable performance, and automatic scaling of throughput capacity, makes it a great fit for mobile, web, gaming, ad tech, IoT, and many other applications.
Everything done in this tutorial is free-tier eligible.
Create and Query a NoSQL Table Requires an Account
Create a Free Account in MinutesAWS Free Tier offers 25 GB of storage, up to 200 million requests per month with Amazon DynamoDB.
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, type DynamoDB in the service search bar and click to open the DynamoDB Console.
In this step, you will use the DynamoDB Console to create a table.
e. Next, we will enable DynamoDB Auto Scaling for our table.
DynamoDB Auto Scaling will change the read and write capacity of your table based on request volume. Using an IAM role called DynamoDBAutoscaleRole, DynamoDB will manage the Auto Scaling process on your behalf. DynamoDB creates this role for you the first time you enable Auto Scaling in an account.
Instruct DynamoDB to create the role by unchecking Use default settings.
f. Scroll down the screen past Secondary indexes, Provisioned capacity and Auto Scaling to the Create button. We won't change these settings for the tutorial.
In the Auto Scaling section, notice that DynamoDB will create the DynamoDBAutoscaleRole role for you.
Now select Create.
When the “Music” table is ready to use, it appears in the table list with a checkbox.
Congratulations! You've now created a NoSQL Table using Amazon Dynamo DB console.
In this step, you will add data to your new DynamoDB table.
In this step, you will search for data in the table using a query operations. In DynamoDB query operations are efficient and use keys to find data while scan operations traverse the entire table.
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.
In this step, you will delete an item from your DynamoDB table.
In this step, you will delete your DynamoDB table.
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 on the radio button next to the Music table 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.
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.
DynamoDB is a great fit for mobile, web, gaming, ad tech, and IoT applications where scalability, throughput and reliable performance are key considerations.
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.