Multi-Region GraphQL API with CloudFront
Publication date: April 25, 2022 (Diagram history)
This architecture shows how to reduce latency for end users while increasing your application's availability. You can provide GraphQL API endpoints in multiple AWS Regions with active/active real-time data synchronization supported by Amazon DynamoDB global tables.
Multi-Region GraphQL API with CloudFront
The following steps describe the architecture:
-
Deploy a GraphQL API in two or more AWS Regions using Amazon AppSync, then handle the AppSync commands and queries using AWS Lambda resolvers connected to a DynamoDB database.
-
To notify clients about data changes across all Regions, enable DynamoDB global tables to keep data in sync across Regions. Handle DynamoDB data streams with a Lambda handler, triggering purposely built GraphQL schema subscriptions.
-
To support custom domains, upload the domain's SSL Certificate into AWS Certificate Manager (ACM) and attach it to an Amazon CloudFront distribution.
-
Point your domain name to CloudFront by using Amazon Route 53 as your DNS name resolution service.
-
Set up a routing rule on Route 53 to route your global clients to the Region with the lowest latency to their location.
-
To authenticate clients seamlessly to AppSync endpoints in any Region, use Lambda@Edge to query Route 53 for the best Region to forward the request to, and to normalize authorization by abstracting the specificities of each Regional AppSync.
-
Clients across the globe can then connect to your GraphQL API on a single endpoint available in edge locations.
-
CloudFront seamlessly routes client requests to the API in the Region with the lowest latency to the client's location.
Further reading
For additional information, refer to the following resources:
Diagram history
To be notified about updates to this reference architecture diagram, subscribe to the RSS feed.
| Change | Description | Date |
|---|---|---|
Initial publication | Reference architecture diagram first published. | April 25, 2022 |
Note
To subscribe to RSS updates, you must have an RSS plugin enabled for the browser you are using.