A DynamoDB primary key identifies an item. A simple key has a partition key; a composite key has a partition key and sort key. Two shipments can share a customer partition while remaining separate items because their shipment sort keys differ. Reusing the full primary key replaces the item unless you apply a suitable conditional write.
Query uses partition-key equality and can constrain the sort key. Scan reads across the table or index. A filter is applied after reading, so it doesn't turn a broad scan into a key-efficient query. Start from the access pattern: list a customer's shipments, fetch one shipment, or search a different attribute. That decision determines the key and index design before you worry about how the results are displayed.