AWS AppSync
AWS AppSync Developer Guide

(Optional) Guided schema Wizard

AWS AppSync can guide you through the process of creating your GraphQL API, including deploying data sources and connecting with resolvers. This guided creation or wizard gives you a form builder interface where you can add or remove attributes while creating a data model for your application to store in the cloud with GraphQL.

Create API

From the AWS AppSync home page, choose Create API and then choose Create with wizard. You are prompted to define your model and its related fields and functionality. A model is an object type that is added to your API and is backed by Amazon DynamoDB that comes preconfigured with GraphQL queries, mutations, and subscriptions. Models are how you define the data types of your application and how they are stored in the cloud. A model contains one or more fields that hold the specific attributes of your data type. For example, a blog model might have the following fields: id, title, and isPublished. These fields could have primitive types of id, string, or Boolean in addition to the custom scalars that AWS AppSync supports.

Populate Model

After you enter the model form, you can change the name of your model, which in turn defines the names of your GraphQL operations (that is, queries, mutations, and subscriptions). This also defines the name of your Amazon DynamoDB tables, but you can override that in the Configure model table section at the bottom of the screen.

Next, add one or more fields using logical names and types that suit your model. To view all available primitive types in AWS AppSync, choose the drop down under Types. Additionally, you can select one or both of the check boxes next to each field to mark it as a List or Required.

Types that are marked as List can hold multiple values. For example, if you had a blog Post model and a field called Categories" you could mark this as a **List to return multiple categories when running a query. Required fields must be entered as input when executing a GraphQL mutation.

Finally, you can use the Configure model table section at the bottom to optionally add an index. This is useful when you know that certain fields in your model will be queried frequently. For example, if the isPublished field of your blog model is going to be frequently queried to give all blogs that are published, you could create an index on that field. This automatically creates proper Amazon DynamoDB indexes and GraphQL queries for you.

After you are satisfied with your model and optional table configuration, choose Next and then the resource is created.

Execute GraphQL

After the process is complete, pre-populated GraphQL mutations and queries open in the editor for you to run on the Queries page of the AWS AppSync console. Choose the play button at the top and choose the option that starts with Create <model name> (this option name changes depending on your model name). A GraphQL mutation runs and places data in your Amazon DynamoDB table. You can then choose the play button again and select the option starting with List to view all of the records by running a GraphQL query.

Integrate with the App

After you complete a tour of the console, choose the root of the AWS AppSync navigation bar on the left to follow instructions for integrating a GraphQL API with your mobile or web app.