Connecting Amplify AppSync to an imported DynamoDB Table

Jacob Clark
5 min readMay 21, 2021
Amplify+AppSync with a Custom DynamoDB Resource

Amplify makes building apps easy, annotate your GraphQL schema with @model and Amplify will happily generate you a DynamoDB table you can Query/Mutate/Subscribe too…

What about when you have a DynamoDB Table created outside of Amplify? Maybe through CDK or CloudFormation (or just the console)? Or in other words, how do you Bring Your Own Database to Amplify?

The good news is, Amplify has you covered with Custom Resources, in this post, I’m going to walk you through it.

Firstly, have a quick read of Overwrite & customize resolvers in the Amplify docs, it’s almost there but not quite comprehensive enough for this particular use case.

OK, ready to go?

We’re going to hook up a DynamoDB table holding information about Lego sets and create a query so that we can fetch a set by its name.

This is the query in DynamoDB that we want to replicate in AppSync:

DynamoDB index query

First, import your DynamoDB Table via the Amplify CLI

amplify import storage

--

--

No responses yet