Skip to content
VirtualLP Virtual Learning Platform
Amazon Web Services AWS-07 intermediate

Model data in DynamoDB: partition and sort keys, Query vs Scan, and a GSI

Design an Orders table around its access patterns: composite primary key, items with flexible attributes, efficient Query versus expensive Scan, and a global secondary index for a second access pattern.

What you'll do

  • Choose partition and sort keys from access patterns
  • Write items with different attributes
  • Compare Query and Scan cost
  • Add a GSI for a new access pattern

Lab tasks

  1. 1 Create table CustomerOrders
  2. 2 Add four orders for two customers
  3. 3 Query one customer’s orders
  4. 4 Query a date range with the sort key
  5. 5 Scan with a filter and compare
  6. 6 Add a GSI for “orders by status”
  7. 7 Query the index