Create DynamoDB table

  1. Open DynamoDB console, then Click Create table DynamoDBConsole

  2. Enter table name: Books

    • Enter parition key: id
    • Enter sort key: rv_id (review id), type is Number DynamoDBConsole
  3. Scroll down to Table settings pattern, select Customize settings

    • Then, select On-demand
    • Click Create local Index DynamoDBConsole
  4. Enter sort key: name

    • Enter index-name: name-index
    • Click Create index DynamoDBConsole
  5. Scroll down to the bottom, click Create table DynamoDBConsole So we have created the Books table with the Local secondary index of name-index

  6. To add data to the table, you can download the file below:

  7. Open this file, replace all <AWS-REGION> with the region where you created the S3 book-image-resize-shop bucket, for example: ap-southeast-2 DynamoDBConsole

  8. Run the following command in the directory where you save the dynamoDB.json

    aws dynamodb batch-write-item --request-items file://dynamoDB.json
    

    DynamoDBConsole