Generating a GraphQL API From Your Database — The Magic of AWS AppSync

Serverless Guru
Serverless Guru
Published in
3 min readMay 26, 2019

--

How to fast-track your GraphQL API creation

Peppermint (aka 馒头) — one of many Serverless Guru cats

This hands-on guide will hold your hands through each step as you let AWS create a GraphQL API for you using a DynamoDB table.

If you already have a DynamoDB table you want to use, skip ahead to the next section. If not, then go ahead and create a table of magical kittens:

  1. Go to Services > DynamoDB
  2. Click Create table.
  3. For Table name, enter: Magical-Kittens-Table
  4. For Primary key, enter: kitten_id
  5. Click Create.
  6. Then Create item.
  7. For Item {1} kitten-id, enter: brit-shorthair1
  8. Click on the + and Append a Number: { age : 0.5}
  9. Append a String: { personality : fierce }
  10. Append a Boolean: { magical: true } and click Save.
DynamoDB table in the AWS console

Voila! You now have a table. Let’s make that API now:

  1. Go to Services > AWS AppSync.
  2. Click Create API.
  3. Select Import DynamoDB

--

--

Serverless Guru
Serverless Guru

We can help you migrate to serverless, build serverless applications, and train your team on serverless best practices. https://www.serverlessguru.com