AWS AppSync
AWS AppSync is a serverless service from Amazon Web Services used to build GraphQL APIs with real-time data synchronization and offline programming features, managing and synchronizing data across multiple mobile devices and users.
Key points
- GraphQL is a data language built to allow apps to fetch data from servers.
- AWS is retiring the older service AppSync effectively replaced here: Amazon Cognito Sync is closed to new customers (per AWS’s Cognito Sync availability-change notice), and AWS explicitly recommends AWS AppSync (for real-time cross-device data sync via GraphQL) or Amazon DynamoDB (for simple key-value user data) as the alternatives. Existing Cognito Sync customers are unaffected but the service gets no new features.
- Improves performance by providing data caches, provides subscriptions to support real-time updates, and provides client-side data stores to keep offline clients in sync.
- AppSync Events is a newer, separate capability alongside the GraphQL API: it creates serverless WebSocket APIs for pub/sub, broadcasting real-time events (chat, live scores, notifications, activity feeds) to millions of subscribers with no API code required. Events publish to channels grouped under namespaces, support unicast/multicast/broadcast delivery, and let you attach
OnPublish/OnSubscribehandlers to transform, filter, or reject events and subscriptions. - Offers advantages over plain GraphQL, such as an enhanced coding style and seamless integration with modern tools and frameworks like iOS and Android.
- The AppSync interface provides a live GraphQL API feature that lets users test and iterate on GraphQL schemas and data sources quickly.
- Paired with the Amplify Framework, which helps build mobile and web applications using GraphQL APIs.
- Operation types:
- Queries — for fetching data from the API.
- Mutations — for changing data via the API.
- Subscriptions — connections for streaming data from the API.
- Supported data sources: Amazon DynamoDB tables, Amazon RDS databases, Amazon Elasticsearch (now Amazon OpenSearch Service), AWS Lambda functions, and third-party HTTP endpoints.
- Typical flow: a mobile/app user sends GraphQL queries/mutations to AppSync, which routes them through GraphQL resolvers to DynamoDB, with subscriptions streaming updates back to the user.
- Distinct from Amazon API Gateway, which is the fully managed service for building, publishing, monitoring, securing, and maintaining general-purpose (REST/HTTP) APIs; AppSync is specifically for GraphQL APIs.
- Its GraphQL API endpoint is one of the resource types AWS WAF can protect, alongside CloudFront, API Gateway, ALB, and Cognito user pools.