SysPad › Lessons › networking lessons › AWS AppSync
How AWS AppSync works
Managed GraphQL API with real-time subscriptions. Each operation fans out to N resolvers against DynamoDB, Lambda, HTTP, or RDS - so downstream load is a multiple of client RPS. Caching removes resolver round-trips.
REST makes the client take what each endpoint gives, often too much, sometimes too little, and several round-trips to build one screen. AppSync is managed GraphQL: the client asks for exactly the fields it needs in a single query, and AppSync gathers them from whatever data sources sit behind it, with real-time updates built in.
What you will learn
- What problem with REST does GraphQL solve (over- and under-fetching)?
- What are resolvers, and how do they connect a query to real data?
- How does AppSync deliver real-time updates to clients?
- When is GraphQL/AppSync a better fit than a REST API?
Ask for exactly what you need
GraphQL exposes one endpoint and a schema of types and fields. The client sends a query naming precisely the fields it wants, even across related types, and gets back that shape, no more, no less. One request replaces several REST calls.
Resolvers: schema meets data
A resolver tells AppSync how to fetch a given field from a data source, DynamoDB, Lambda, an RDS database, or an HTTP endpoint. A single query can stitch together data from several sources behind the scenes.
So AppSync is also an aggregation layer: the client sees one clean graph; the messy multi-backend reality is hidden in resolvers.
⚓ Mobile/web apps with rich data needs, backends-for-frontends, and apps unifying several data sources.
Real-time subscriptions
Beyond queries (read) and mutations (write), GraphQL has subscriptions: clients subscribe to changes and AppSync pushes updates to them over WebSockets automatically. Live data without you building the socket plumbing.
⚓ Chat, collaborative apps, live feeds, and dashboards that must update as data changes.
AppSync vs a REST API
Choose AppSync/GraphQL when clients have varied, nested data needs, you want to avoid over/under-fetching, aggregate multiple sources, or need built-in real-time. Choose a REST API for simple, well-defined endpoints, or when GraphQL’s flexibility (and its caching/complexity trade-offs) isn’t worth it.
Flashcards
- What REST pain points does GraphQL address?
- Over-fetching (getting unneeded fields) and under-fetching (needing many calls). One query returns exactly the requested shape.
- What is a resolver in AppSync?
- The mapping from a schema field to a data source (DynamoDB, Lambda, RDS, HTTP). One query can pull from several via resolvers.
- How does AppSync give clients real-time data?
- GraphQL subscriptions: clients subscribe and AppSync pushes updates over WebSockets, no socket plumbing to build.
- How can one AppSync query use multiple backends?
- Different fields have different resolvers, so a single query can stitch data from DynamoDB, Lambda, RDS, and HTTP sources.
- When is REST the better choice over AppSync?
- For simple, well-defined endpoints where GraphQL’s flexibility and its caching/complexity trade-offs aren’t worth it.
Sources
- AWS, What is AWS AppSync (GraphQL)
- AWS, Resolvers and data sources
- AWS, Real-time data with subscriptions
Open the SysPad canvas · Official AWS AppSync documentation