Skip to content
Related Articles

Related Articles

Improve Article
Amazon Web Services – Creating an AppSync GraphQL API
  • Difficulty Level : Hard
  • Last Updated : 15 Mar, 2021

AppSync is an AWS service that helps you by simplifying the process of developing /building applications by letting developers create flexible, secure, extensible, and real-time  APIs. It helps developers to manage and integrate mobile application data in real-time across devices and users, and at the same time allows the data to be accessed and modified when the mobile device is in an offline state. 

AppSync exists in between the client apps and the AWS web services which include DynamoDB, Amazon Aurora, Lambda, Amazon Elasticsearch service, etc. 

AppSync

GraphQL is a language for APIs in AppSync that enables us to query and manipulate data easily through built-in and flexible syntax.

Unlike root API the GraphQL user decides what to receive rather than the server it is also fast, flexible as well as easy.

Benefits of AppSync :

1. Fast set upscale up as needed :

There are no servers to manage, AppSync provides a fully managed GraphQL setup, which has built-in high availability serverless infrastructure. You can create a GraphQL API in seconds through AWS CLI, Console, Amplify CLI, or cloud formation.



2. Simple and secure data access :

In AppSync you can perform complex queries and aggregation across multiple data sources with a single network call by using GraphQL. AppSync helps us to secure app data by using multiple simultaneous authentication modes as well as allowing us to define security and fine-grained access control at the data structure level directly from GraphQL schema.

3. Real-time subscriptions :

AppSync provides real-time subscription as well as offline access to app data. When your offline device tries to reconnect AWS appsync automatically syncs only the updates that occurred when the device was not connected instead of fetching the entire data set. AppSync manages data conflicts by offering user-customizable server-side conflict detection and resolution.

Creating an AWS AppSync GraphQL API :

Prerequisite:

Implementation:

Follow the below steps to create an AWS AppSync GraphQL API:

Step 1: Go to your AWS management console and search for AppSync. Now go to Create API on the AppSync dashboard.

AppSync Dashboard

Step 2: Choose Build from scratch in order to build your API from scratch and define your own schema. 

Build API from scratch

Step 3: Give a name to your API

Give name to your API

Step 4: You can check your API configuration or details like API URL, API ID, Primary Auth mode, Auth Key in Settings.

Your API configuration

Step 3: Go to Schema -> Create Resources and define your Schema according to your data. Schema is a text file written in GraphQL schema language also called Schema Definition Language(SDL).

Create Schema by clicking on create resources

Step 4: Define your Schema first give a custom type name and then declare fields in it.

define schema

Step 5: Your Schema with given fields and Resolvers are created. Resolvers help AWS AppSync to translate GraphQL requests and fetch information from your AWS resources.

Schema and resolver created successfully

Step 6: Your TODO Table created, will hold data in the fields that you have defined in your schema.

TODO table

Step 7: Select your TODO table given above to see your TODO table, you can delete your data manually here.

TODO Table

Your AWS AppSync GraphQL API is successfully created and ready to be integrated with your applications

My Personal Notes arrow_drop_up
Recommended Articles
Page :