Create Orders table

1. Details

  • Table Name: orders
  • Description: This table will simulate the data of each order status.
  • Billing Mode: PAY_PER_REQUEST (On-demand)
  • Partition Key: orderId (String)

2. Attributes

Attribute NameType
orderIdString
statusString
itemsList
totalNumber

3. Create table

3.1. Go to DynamoDB service in AWS console, remember to choose us-east-1

1-dynamodb

3.2. At the left panel, choose Tables -> Choose Create table

2-dynamodb

3.3. Next, we will fill some information about our table, the table name is orders and the Partition key is orderId

3-dynamodb

3.4. Final click Create table

4-dynamodb

Create orders table successful

5-dynamodb

3.5. Next, we need to create some records for simulate data of our service, let’s choose the table we just created

6-dynamodb

3.6. Click Create item at the menu Actions

7-dynamodb

3.7. Choose JSON view and paste following JSON below to Attributes, final choose Create item

{
  "orderId": {
    "S": "12345"
  },
  "status": {
    "S": "DELIVERED"
  },
  "items": {
    "SS": [
      "Widget A",
      "Gadget B"
    ]
  },
  "total": {
    "N": "150"
  }
}
8-dynamodb

After created, you need to refresh the page

9-dynamodb

Then repeat from the step 3.6 with another data

{
  "orderId": {
    "S": "6789"
  },
  "status": {
    "S": "PROCESSING"
  },
  "items": {
    "SS": [
      "Gizmo C"
    ]
  },
  "total": {
    "N": "75.50"
  }
}

Yeah, we got 2 records in our orders table, let’s go to the next step

10-dynamodb