AWS Made Easy
Close this search box.

Tip #23: How to use AppSync to access multiple data sources in AWS

Access multiple data sources with higher security, flexibility, and performance using AWS AppSync

Traditional applications used to have one database for everything. With modern applications, you will often face multiple data sources, each with a different purpose and optimization. AWS services are typically well integrated with each other, however there are easier ways than accessing all data sources directly from your application.

What is AWS AppSync?

AWS AppSync is a fully managed service that allows you to connect to multiple databases, microservices, APIs, and other data sources, with the following benefits:

  • Secure data access: you can define fine-grained access control policies, and use multiple concurrent authentication modes
  • Performance: built-in caching, subscriptions to real-time updates, and client-side data stores with offline capabilities
  • Automatic scaling: AppSync takes care of scaling the GraphQL execution engine up and down to meet customer demands
  • Fewer network requests: with GraphQL you can retrieve the relevant data in a single request, counteracting the N+1 problem when fetching all your items with subsequent requests to get the details for each one of them
  • Flexibility: you can add, modify, and swap your data sources in AppSync without modifying your application code
  • Development speed: you can combine the data from different sources with a single GraphQL query – this is much faster than creating a backend for each data source

Flexibility and performance

GraphQL provides enormous flexibility when accessing data sources, and with its built-in caching can provide great performance. However, there are some cases where you should pay attention to how the data source is structured. If you use DynamoDB with a single table design, you will have to compromise. Nested GraphQL resolvers will provide maximum flexibility, but reintroduce the N+1 problem. If you want maximum performance, you need to restructure your GraphQL resolvers into broader, more complex resolvers, optimized for your known access pattern. Check out Alex DeBrie’s blog about GraphQL, DynamoDB, and single-table design for more details about this particular case.


AWS AppSync is a great tool to access multiple data sources and speed up your application development. It is future-proof and provides great performance and scalability.


AWS Made Easy


Leave a Reply

Your email address will not be published. Required fields are marked *

Related Tips & Tricks