Guided Lab: Creating an Amazon DynamoDB table
Description
Amazon DynamoDB is a fully managed NoSQL database service that provides fast and predictable performance with seamless scalability. DynamoDB lets you offload the administrative burdens of operating and scaling a distributed database so that you don’t have to worry about hardware provisioning, setup, and configuration, replication, software patching, or cluster scaling. DynamoDB also offers encryption at rest, which eliminates the operational burden and complexity involved in protecting sensitive data.
Objectives
In this lab, you will learn how to:
- Understand the basics of Amazon DynamoDB
- Create a DynamoDB table
- Understand Point-in-time recovery for DynamoDB
Lab Steps
Creating an Amazon DynamoDB table
1. Navigate to DynamoDB.
- In the AWS Management Console, navigate to the DynamoDB service.
2. Create a Table: In the DynamoDB console, choose “Create Table”. This will open the “Create DynamoDB table” screen.
3. Enter Table Details: You’ll need to provide a name for your table and define the primary key. The primary key uniquely identifies each item in the table, so it must be unique for each item.
- Table name: This could be anything relevant to the data you’re storing. For example, “Movies”.
- Partition key: This could be any attribute of your data. For example, “Year”. This will serve as the primary means of partitioning the data in your table.
- Sort key (optional): This is another attribute that DynamoDB uses to organize the data in the table. For example, “Title”.
- Data types: Amazon DynamoDB supports many different data types for attributes within a table. Here are some of those:
- Number: Positive, negative, or zero.
- String: A sequence of Unicode characters.
- Binary: Binary data.
4. Set up the default settings. You can leave the default settings as they are for now.
5. Create the table. Click on the “Create table” button to create your table. It might take a few minutes for DynamoDB to create your table and set it up for you.
6. Once the table is in ACTIVE status, it’s considered best practice to enable Point-in-time recovery for DynamoDB on the table. Point-in-time recovery provides continuous backups of your DynamoDB data for 35 days to help you protect against accidental write or delete operations.
To do this, from your Dynamo DB Table Console, go to the Backups Tab, and click “Edit”. Check the checkbox “ Turn on point-in-time recovery”, and Click “Save changes”.
7. Review the Table: After creating the table, you can review its details in the DynamoDB console. You can also insert items into the table and query the data.
Remember, DynamoDB tables are schemaless—other than the primary key, you do not need to define any extra attributes or data types when you create a table. This makes DynamoDB a flexible and powerful tool for working with data at any scale.
Congratulations! You’ve successfully created a table in Amazon DynamoDB. Happy exploring!