Amazon DynamoDB Query for Items whose key contains a substring

You can only query the hashKey using the equality operator (EQ). That being said if those values ("abcd_aaa", "abcd_bbb", "abcd_ccc") belong to your hashKey then you have to provide them entirely. On the other hand, the Query operation does allow partial matching on the rangeKey with the option of a few additional comparison operators:

EQ | LE | LT | GE | GT | BEGINS_WITH | BETWEEN

See the Query documentation for more details.

One possibility would be to use a hashKey and rangeKey where the first part of your code would be the hashKey and the last the rangeKey, example:

hashKey : abcd
rangeKey : aaa

By doing this when you query by hashKey (abcd), you would receive all three records sorted by the rangeKey