AppSync Simple Tutorial
Tags: graphql, beginners, aws
Published: 2021-12-29 13:37:02


CREATE A SIMPLE GRAPHQL API
===========================

*How to create a very simple GRAPHQL API with AWS AppSync.*

Log into AWS and open the “AWS APPSYNC” module. This is where we will create an APPSYNC API to be used later.

[![](http://norristechnologies.com/wp-content/uploads/Screen-Shot-2021-12-23-at-9.47.50-AM-500x378.png)](http://norristechnologies.com/wp-content/uploads/Screen-Shot-2021-12-23-at-9.47.50-AM.png)1. Click the orange Create API in the upper right hand corner of the page. Screen should look like the one to the left.

[![](http://norristechnologies.com/wp-content/uploads/Screen-Shot-2021-12-23-at-9.49.28-AM-500x377.png)](http://norristechnologies.com/wp-content/uploads/Screen-Shot-2021-12-23-at-9.49.28-AM.png)2. Click “Create with wizard” in order to build a very simple GraphQL API. AWS does much of the work for you this way. Screen should look like the one to the left.

[![](http://norristechnologies.com/wp-content/uploads/Screen-Shot-2021-12-23-at-9.49.28-AM-500x377.png)](http://norristechnologies.com/wp-content/uploads/Screen-Shot-2021-12-23-at-9.49.28-AM.png)3. Enter in “firstName”, “lastName” fields and name the api model “testModel”. Screen should look like the one to the left.

[![](http://norristechnologies.com/wp-content/uploads/nameGraphQLAPI-500x377.png)](http://norristechnologies.com/wp-content/uploads/nameGraphQLAPI.png)4. Once you hit “Start”, you will enter the name of your app as “graphQLTest” Your screen should look like one to the left.

[![](http://norristechnologies.com/wp-content/uploads/Screen-Shot-2021-12-23-at-10.35.42-AM-500x378.png)](http://norristechnologies.com/wp-content/uploads/Screen-Shot-2021-12-23-at-10.35.42-AM.png)5. Click “Start“ to begin the wizard. It will open to the model edit screen. Your screen should look like one to the left.

[![](http://norristechnologies.com/wp-content/uploads/Screen-Shot-2021-12-23-at-10.39.20-AM-500x377.png)](http://norristechnologies.com/wp-content/uploads/Screen-Shot-2021-12-23-at-10.39.20-AM.png)6. You will leave everything the same and hit “create”. Your screen should look like one to the left.

[![](http://norristechnologies.com/wp-content/uploads/Screen-Shot-2021-12-23-at-10.42.33-AM-500x234.png)](http://norristechnologies.com/wp-content/uploads/Screen-Shot-2021-12-23-at-10.42.33-AM.png)7. Once again, you will leave everything the same and hit “create”. This time, after the dynamodb builds, Your screen should look like one to the left.

[![](http://norristechnologies.com/wp-content/uploads/Screen-Shot-2021-12-23-at-10.45.23-AM-500x233.png)](http://norristechnologies.com/wp-content/uploads/Screen-Shot-2021-12-23-at-10.45.23-AM.png)8. Click on the orange array, and choose “createMyModelType” in order to generate the model. Your screen should look like one to the left.

[![](http://norristechnologies.com/wp-content/uploads/Screen-Shot-2021-12-23-at-10.50.30-AM-500x234.png)](http://norristechnologies.com/wp-content/uploads/Screen-Shot-2021-12-23-at-10.50.30-AM.png)9. Next click the orange array about and choose “createMyModelType”, in order to insert a record into this new dynamoDB table. Your screen should look like one to the left.

[![](http://norristechnologies.com/wp-content/uploads/Screen-Shot-2021-12-23-at-10.52.55-AM-500x234.png)](http://norristechnologies.com/wp-content/uploads/Screen-Shot-2021-12-23-at-10.52.55-AM.png)10. Now your api is generated. We need to get the information to call it. Next, click on the “Settings” tab. Your screen should look like one to the left.

[![](http://norristechnologies.com/wp-content/uploads/Screen-Shot-2021-12-23-at-10.55.07-AM-500x239.png)](http://norristechnologies.com/wp-content/uploads/Screen-Shot-2021-12-23-at-10.55.07-AM.png)11. Write down the API URL, as well as the api key listed under “API Keys”. Your screen should look like one to the left.

Now you have a GRAPHQL Api..pretty simple eh? You can call it using any language you wish.