AWS AppSync is a fully-managed serverless GraphQL infrastructure. Because it runs on a serverless, managed infrastructure, it scales automatically and does not require any manual installation nor any maintenance. Thus, AppSync allows us to get started quickly without any impediments. And right from the start, we can focus on creating functionality with business value.
But don’t get lost!
Let’s have a look at the AppSync architecture. In the figure below we have depicted such a high-level solution architecture for an app, an AppSync API and AWS data sources. On the left-hand side we have the clients connecting to the API in the middle, and on the right-hand side, we have the data sources feeding the API.
The API is realized on the AppSync infrastructure, using GraphQL concepts, and it is secured using e.g. AWS Cognito. The API is defined by a GraphQL schema, consisting of types, queries, mutations, and subscriptions. The data of the API is delivered by any of the AWS data sources on the right: an Amazon DynamoDB, Amazon Elasticsearch or an AWS Lambda function. The raw data delivered by the data sources is transformed to GraphQL with a resolver.
AppSync clients use the GraphQL API. The clients interact with the API using the GraphQL query language.
GraphQL Server and Schema
AWS AppSync has a powerful GraphQL server, which is used by all APIs on AppSync. Each API supports the definition of custom types and the three GraphQL methods: query (read-only), mutation (write), and subscription (event-based notification).
The data served via a GraphQL API is usually in an existing database. AppSync offers a convenient way to connect databases from the AWS cloud:
• Amazon DynamoDB
• Amazon Elasticsearch
• Services deployed on AWS Lambda
Resolvers define a mapping from a GraphQL request to a data source request and from a data source response back to a GraphQL response. According to these two steps, the mapping consists of request mapping and a response mapping. Writing resolvers is the main software development activity when creating a GraphQL API. AppSync uses new concepts, a templating language and predefined templates to simplify resolver development. You’d be able to monitor all of these operations using aws cloud monitoring software.
Do you want to get deeper into AppSync and GrapphQL? Check out the AWS AppSync Book.