We use essential cookies and similar tools that are necessary to provide our site and services. We use performance cookies to collect anonymous statistics, so we can understand how customers use our site and make improvements. Essential cookies cannot be deactivated, but you can choose “Customize” or “Decline” to decline performance cookies.
If you agree, AWS and approved third parties will also use cookies to provide useful site features, remember your preferences, and display relevant content, including relevant advertising. To accept or decline all non-essential cookies, choose “Accept” or “Decline.” To make more detailed choices, choose “Customize.”
Essential cookies are necessary to provide our site and services and cannot be deactivated. They are usually set in response to your actions on the site, such as setting your privacy preferences, signing in, or filling in forms.
Performance cookies provide anonymous statistics about how customers navigate our site so we can improve site experience and performance. Approved third parties may perform analytics on our behalf, but they cannot use the data for their own purposes.
Functional cookies help us provide useful site features, remember your preferences, and display relevant content. Approved third parties may set these cookies to provide certain site features. If you do not allow these cookies, then some or all of these services may not function properly.
Advertising cookies may be set through our site by us or our advertising partners and help us deliver relevant marketing content. If you do not allow these cookies, you will experience less relevant advertising.
Blocking some types of cookies may impact your experience of our sites. You may review and change your choices at any time by selecting Cookie preferences in the footer of this site. We and selected third-parties use cookies or similar technologies as specified in the AWS Cookie Notice.
We and our advertising partners (“we”) may use information we collect from or about you to show you ads on other websites and online services. Under certain laws, this activity is referred to as “cross-context behavioral advertising” or “targeted advertising.”
To opt out of our use of cookies or similar technologies to engage in these activities, select “Opt out of cross-context behavioral ads” and “Save preferences” below. If you clear your browser cookies or visit this site from a different device or browser, you will need to make your selection again. For more information about cookies and how we use them, read our Cookie Notice.
To opt out of the use of other identifiers, such as contact information, for these activities, fill out the form here.
For more information about how AWS handles your information, read the AWS Privacy Notice.
We will only store essential cookies at this time, because we were unable to save your cookie preferences.
If you want to change your cookie preferences, try again later using the link in the AWS console footer, or contact support if the problem persists.
AWS Tutorials Directory
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 by 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 make it a great fit for mobile, web, gaming, ad tech, IoT, and many other applications.Everything done in this tutorial is free-tier eligible.
Beginner
10 minutes
Free Tier eligible
[**]Accounts created within the past 24 hours might not yet have access to the services required for this tutorial.
January 12, 2024
In this step, you will use the DynamoDB console to create a table.
a. In the DynamoDB console, choose Create table.
b. We will use a music library as our use case for this tutorial. In the Table name box, type Music.
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 box.
d. Because each artist may write many songs, you can enable easy sorting with a sort key. Enter songTitle in the Sort key box.
e. Next, you will enable DynamoDB auto scaling for your table.
DynamoDB auto scaling will change the read and write capacity of your table based on request volume. Using an AWS Identity and Access Management (AWS IAM) role called DynamoDBAutoscaleRole, DynamoDB will manage the scaling process on your behalf. DynamoDB creates this role for you the first time you enable auto scaling in an account.
To enable DynamoDB auto scaling for your table, select Customize settings.
f. Scroll down the screen past Secondary indexes, Estimated read/write capacity cost, Encryption at rest, and Tags to the Create table button. We won't change these settings for the tutorial.
Now choose Create table.
When the Music table is ready to use, it appears in the table list with a check box.
Congratulations! You have created a NoSQL table using the DynamoDB console.
In this step, you will add data to your new DynamoDB table.
a. Select Explore items from the left menu, then select the radio button next to the Music table. Click the Create item button.
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.
Choose Create item.
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
In this step, you will search for data in the table using query operations. In DynamoDB, query operations are efficient and use keys to find data. Scan operations traverse the entire table.
a. Select the arrow next to "Scan/Query items". Then select "Query".
b. You can use the console to query the Music table in various ways. For your first query, do the following:
In the Artist box, type No One You Know, and choose Run. All songs performed by No One You Know are displayed.
Try another query:
In the Artist box, type The Acme Band, and choose Run. All songs performed by The Acme Band are displayed.
c. Try another query, but this time narrow down the search results:
In the Artist box, type The Acme Band.
In the songTitle box, select Begins with from the dropdown list and type S.
Choose Run. Only "Still in Love" performed by The Acme Band is displayed.
In this step, you will delete an item from your DynamoDB table.
a. Change the Query dropdown list back to Scan.
Select the checkbox next to The Acme Band. In the Actions dropdown list, choose Delete items. You will be asked whether to delete the item. Choose Delete and your item is deleted.
In this step, you will delete your DynamoDB table.
a. You can easily delete a table by using the DynamoDB console. It is a best practice to delete tables you are no longer using so that you don’t keep getting charged for them.
In the DynamoDB console, select the checkbox next to the Music table and then choose Delete.
In the confirmation dialog box, enter the text delete and choose Delete table.
Congratulations! 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.