Query for AWS DynamoDB Items by ID With an AppSync GraphQL API

InstructorTomasz Łakomy

Share this video with your friends

Send Tweet

As of now, we can only create a single book or query for ALL of the books. Let's create a query that searches for a book by its ID.

It is very similar to querying for all of the books. You can copy over the code for the list books Lambda and then create a new handler function.

The function deviates since you need to search for a book by its ID. You will use the DynamoDB DocumentClient method, .put instead of .list . And you will pass that function an ID.