Create DynamoDB Table

Create DynamoDB Table

  1. Open DynamoDB console, then click Create table DynamoDBConsole

  2. Enter table name: Books

    • Enter partition key: id (String)
    • Enter sort key: rv_id (Number) - review id

DynamoDBCreate

  1. Scroll down to Table settings section

    • Select Customize settings

DynamoDBSettings

  1. Select On-demand for Read/write capacity settings

    • Click Create local index

DynamoDBIndex

  1. Configure local secondary index:

    • Sort key: name (String)
    • Index name: name-index
    • Click Create index

DynamoDBIndexConfig

  1. Scroll down and click Create table DynamoDBCreateTable

  2. Wait for table creation to complete DynamoDBCreating

Add Sample Data

  1. Download the data file below: dynamoDB.json

  2. Open the file and replace all <AWS-REGION> with your region (e.g., ap-southeast-1) DynamoDBData

  3. Run the following command in the directory where you saved dynamoDB.json:

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

DynamoDBImport

So we have created the Books table with the Local secondary index of name-index and imported sample data.