Last updated on June 23, 2023
AWS AppSync Cheat Sheet
-
A serverless GraphQL and Pub/Sub API service that streamlines the development of modern web and mobile applications
-
AppSync GraphQL APIs – provides a unified endpoint for securely querying and updating data from multiple databases, microservices, and APIs
-
AppSync Pub/Sub APIs – data updates are automatically published to subscribed API clients via serverless WebSockets connections.
-
Concepts
-
GraphQL
-
It allows apps to retrieve data from servers.
-
The GraphQL proxy is a component that runs the GraphQL engine to process requests and map them to logical functions for data operations or triggers.
-
Three level operations:
-
Query – read-only fetch
-
Mutation – write followed by a fetch
-
Subscription – long-lived connection for receiving data
-
-
The operations are exposed via a schema that defines the capabilities of an API.
-
A schema is made up of types, which can be root or user-defined.
-
To build a GraphQL API, you need to have the following:
-
GraphQL Schema – each GraphQL API is defined by a single GraphQL schema.
-
Data Source – AWS resources that GraphQL APIs can interact with.
-
Resolvers – uses mapping templates to convert a GraphQL expression into a format that the data source can use.
-
Unit resolver – performs a single operation against a predefined data source.
-
Pipeline resolver – executes multiple operations against multiple data sources.
-
-
-
You can use a GraphQL client or HTTP to connect to a GraphQL API.
-
-
Real-time data
-
By specifying a GraphQL schema directive on a mutation, you can make any data source in AWS AppSync real time.
-
Data filtering
-
Basic – subscription query filtering based on client-defined arguments.
-
Enhanced – filtering based on logic defined centrally in the backend of the AWS AppSync.
-
-
You can also use specific filtering logic to forcefully unsubscribe and close a WebSocket connection from a connected client.
-
-
Configuration and settings
-
You can cache frequently requested data to reduce the load on your resolvers.
-
By compressing API responses, you can download content faster and save money on data transfer fees.
-
Supports custom domain names for your API.
-
AWS AppSync Monitoring
-
Use Amazon CloudWatch Logs to monitor your AWS AppSync GraphQL API and debug request issues.
-
You can use AWS X-Ray to trace GraphQL requests in AWS AppSync.
-
With AWS CloudTrail, you can log AWS AppSync API calls.
AWS AppSync Security
-
In your API or CLI call, you can specify which authorization type you want:
-
API_KEY
-
AWS_LAMBDA
-
AWS_IAM
-
OPENID_CONNECT
-
AMAZON_COGNITO_USER_POOLS
-
-
Using schema directives, you can specify additional authorization modes at the schema level.
-
You can use AWS WAF to configure a set of rules to protect your web applications and APIs from attacks
AWS AppSync Pricing
-
You are charged for the following:
-
Query and data modification operations.
-
Performing real-time updates on your data.
-
Minutes of connection to AppSync.
-
Dedicated cache instance.
-
AWS AppSync Cheat Sheet References:
https://aws.amazon.com/appsync/
https://docs.aws.amazon.com/appsync/latest/devguide/what-is-appsync.html