Lab 6 2 Getting Started with DynamoDB - max-gallagher/SYS-360 GitHub Wiki
In this lab, you will create a Music Table on DynamoDB with the following details:
Partition key — Artist
Sort key — SongTitle
Deliverables
Submit: Screenshot of 8 entries in table
Submit: Screenshot of successful query
Submit: Screenshot of successful query of AlbumTitle index)
Submit: Screenshot of successful query of new table
Submit Screenshot: Showing the specifics of why the 2 items failed import
Step 1 Creating a Table
-
Under services go to DynamoDB and then navigate to the dashboard
-
Under create resources click create table
- Use the configs shown below and leave everything else as default
- Table name: Music
- Partition Key: Artist
- Sort key: SongTitle
- Use the configs shown below and leave everything else as default
Step 2 Write Data to the Table
-
Using the navigation pane on the left go to tables and select the "Music" table that you just created
-
Select Explore Table Items and create a new item
-
Choose add new attribute then choose number and name it Awards and then create another new attribute that is a string named AlbumTitle
-
Fill in the values of each attribute with the example shown below and then create the item
-
- Create 7 more items with the same attributes but different values
Step 3 Query Data
-
Chose the music table from the table list and choose explore items
-
Under scan or query items select Query and for the Partition Key which is artist put in any artist you set for one of your items then run it
-
A successful query will look like what is shown below
Step 4: Create a Global Secondary Index
-
Return to the tables tab
-
Select music then go to the indexes tab
-
Select Create Index
-
For the Partition key enter AlbumTitle and for the Index Name enter AlbumTitle-Index (It should autofill)
-
Leave everything else as default
-
-
Once complete you should be able to query using the index
-
A successful query using the index is shown below
Step 5 Importing Logs and other Files into DynamoDB
- Create a new s3 bucket for this lab and upload the json files linked in the lab to it
-
From DynamoDB use the Import from S3 feature
-
Select the new s3 bucket
- Name the table and use PK and SK for the respective keys
-
Everything else is default
-
Once created it will have some validation errors but still try and run a query, results of a successful query are shown below
Step 6 Troubleshooting Import
- Follow the Validation Error in DynamoDB to get to the error logs in CloudWatch