0
0
AWScloud~20 mins

Partition key and sort key in AWS - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Partition Key and Sort Key Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
Understanding Partition Key Uniqueness

In a DynamoDB table, what does the partition key uniquely identify?

AThe timestamp when the item was created
BA unique item in the table regardless of sort key
CThe order in which items are stored physically
DA group of items that share the same partition key value
Attempts:
2 left
💡 Hint

Think about how partition keys group data in DynamoDB.

Architecture
intermediate
2:00remaining
Choosing Keys for Efficient Queries

You want to design a DynamoDB table to store customer orders. Each customer can have multiple orders. Which key design allows efficient retrieval of all orders for a single customer?

APartition key: OrderID, Sort key: CustomerID
BPartition key: CustomerName, Sort key: OrderDate
CPartition key: CustomerID, Sort key: OrderID
DPartition key: OrderDate, Sort key: CustomerID
Attempts:
2 left
💡 Hint

Think about grouping orders by customer for fast lookup.

service_behavior
advanced
2:00remaining
Effect of Missing Sort Key in Composite Key Table

In a DynamoDB table with a composite primary key (partition key + sort key), what happens if you try to put an item without specifying the sort key?

AThe operation fails with a validation error
BThe item overwrites an existing item with the same partition key
CThe item is stored with a null sort key value
DThe item is stored but cannot be queried
Attempts:
2 left
💡 Hint

Consider the requirement of composite keys in DynamoDB.

security
advanced
2:00remaining
Access Control Using Partition Key in IAM Policies

You want to restrict users to access only items with a specific partition key value in a DynamoDB table. Which IAM policy condition key helps enforce this?

Adynamodb:Attributes
Bdynamodb:LeadingKeys
Cdynamodb:Select
Ddynamodb:ReturnConsumedCapacity
Attempts:
2 left
💡 Hint

Look for a condition key related to partition key values.

Best Practice
expert
2:00remaining
Designing Partition and Sort Keys for Hot Partition Avoidance

You have a DynamoDB table storing IoT sensor data with a high write rate. Which key design helps avoid hot partitions?

APartition key: SensorID#Date, Sort key: Timestamp
BPartition key: Date, Sort key: SensorID
CPartition key: Timestamp, Sort key: SensorID
DPartition key: SensorID, Sort key: Timestamp
Attempts:
2 left
💡 Hint

Think about spreading writes across partitions by combining keys.