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

image

Submit: Screenshot of successful query

image

Submit: Screenshot of successful query of AlbumTitle index)

image

Submit: Screenshot of successful query of new table

image

Submit Screenshot: Showing the specifics of why the 2 items failed import

image

image

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

image

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

image

  • Create 7 more items with the same attributes but different values

image

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

image

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

image

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

image

  • From DynamoDB use the Import from S3 feature

  • Select the new s3 bucket

image

  • Name the table and use PK and SK for the respective keys

image

  • 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

image

Step 6 Troubleshooting Import

  • Follow the Validation Error in DynamoDB to get to the error logs in CloudWatch

image

image