Build APIs that fetch exactly the data an app needs and push live updates as things change. Stop five in the AWS Hidden Gems series.
About this series
Most AWS learning stops after EC2, S3, IAM, and Lambda. But AWS has over two hundred services, and many of the most useful ones rarely appear in tutorials.
AWS Hidden Gems covers those underrated services you shouldn't ignore. Each article picks one, then explains why it exists, what it does, where it fits, and how to set it up from the console. Know the four basics above and you can follow along. Everything else gets explained as it comes up.
Today's service: AWS AppSync
Modern apps often need two things that are awkward to build: letting the client ask for exactly the data it wants in one request, and pushing live updates to the screen the moment data changes. AppSync gives you both. It is a managed service for building GraphQL APIs, with real time updates included.
Why does this service exist?
Two common API headaches led to AppSync. First, with traditional REST APIs, the client often calls several endpoints and gets back more data than it needs, which is slow on mobile. GraphQL fixes this by letting the client ask for precisely the fields it wants in a single request, but running a GraphQL server yourself means managing servers, connecting data sources, and writing a lot of glue.
Second, live updates. Showing new messages or a changing dashboard in real time usually means managing WebSocket connections, which are long lived two way connections between client and server. Doing that at scale is fiddly.
AppSync handles both. It runs the GraphQL API for you, connects it to your data with little code, and manages the real time connections so updates just arrive.
What is AWS AppSync?
AppSync is a managed GraphQL service. GraphQL is a query language for APIs where the client describes the exact data it wants, and the server returns just that, in one round trip.
You define a schema, which is the shape of your data and the operations allowed on it. You connect each part of the schema to a data source, which AppSync can talk to directly:
- DynamoDB for fast NoSQL storage
- Lambda for any custom logic
- Relational databases, HTTP endpoints, and others AppSync supports three kinds of operations: queries to read data, mutations to change data, and subscriptions to receive live updates. When someone changes data through a mutation, AppSync automatically pushes that change to every client subscribed to it. Authentication is built in, with options including API keys and Amazon Cognito, the AWS user sign in service.
A real world problem
A team is building a shared task board, like a simple Trello. When one person moves a card, everyone else looking at the board should see it move immediately.
Building this the usual way means a REST API for the data plus a separate WebSocket layer to broadcast changes, with code to track who is connected and who cares about which board. That is a lot of plumbing for a small team.
With AppSync, they define the board and card types once, back them with DynamoDB, and add a subscription. Now a mutation to move a card is pushed to every open board automatically. The real time behavior comes almost for free.
Real world use cases
- Chat and messaging apps deliver new messages instantly to everyone in a conversation
- Collaborative tools like shared boards and documents sync changes across users live
- Live dashboards update metrics on screen as new data arrives
- Multiplayer game features share state like scores and moves between players
- Mobile apps fetch lean, exact payloads to stay fast on slow connections
- Apps that work offline sync their changes when the connection returns The pattern is flexible data access plus live updates, without building the real time layer yourself.
Where it fits in AWS
The client app talks to a single AppSync endpoint. AppSync routes each request to the right data source, most often DynamoDB for storage or Lambda for custom logic. Cognito handles who is allowed to do what. For live updates, clients hold a subscription connection to AppSync, and AppSync pushes changes to them.
flowchart LR
A[Client app] -->|GraphQL query or mutation| B[AppSync API]
B --> C[DynamoDB]
B --> D[Lambda]
B -->|Auth check| E[Cognito]
B -->|Live updates| A
AppSync sits between your app and your data, giving one flexible endpoint and handling the real time push.
How the workflow runs
You define a GraphQL schema with your types and operations. You attach data sources and connect each field to an action, such as read this item from DynamoDB. The client sends a query or mutation, and AppSync runs the connected action and returns exactly the requested fields. When a mutation changes data, AppSync notifies every client subscribed to that change over their live connection.
flowchart TD
A[Define GraphQL schema] --> B[Connect fields to data sources]
B --> C[Client sends query or mutation]
C --> D[AppSync runs it against the data source]
D --> E[Return exactly the requested fields]
D --> F[Push updates to subscribed clients]
Setting it up in the AWS Console
You will create a GraphQL API, let AppSync build a DynamoDB backed type, and test it live.
- Sign in to the AWS Console, search for AppSync, and open it. Check the region in the top right corner.
- Click Create API, choose GraphQL APIs, and pick the option to design from scratch. Give the API a name and create it.
- Open the Schema page. Define a simple type and the operations for it, for example a Task type with an id and a title, and queries and mutations to create and list tasks.
- Use the Create Resources shortcut on the schema. AppSync can generate a DynamoDB table and the resolvers, which are the small pieces that connect each GraphQL field to a table action, so you do not write them by hand.
- Go to the Queries page, a built in tool for running operations against your API. Run a mutation to create a task, then a query to list tasks, and confirm your data comes back.
- To see real time updates, open a subscription in the Queries page in one browser tab, then run a create mutation in another. The new task appears in the subscription tab immediately.
- For your app to call the API, note the API URL and set an authorization mode under Settings. An API key is fine for testing, while Cognito is the usual choice for real users. Confirm a call works from your code using the URL and key. Common mistakes: an unauthorized error usually means the request is missing the API key or Cognito token the API expects, so check the authorization mode and that your client sends the right credential. If a field returns null, its resolver is probably not connected to a data source yet.
Using it from code
With AppSync, the code is your GraphQL schema and the operations clients run against it. Here is a small schema and the three operation types.
type Task {
id: ID!
title: String!
done: Boolean!
}
type Query {
listTasks: [Task]
}
type Mutation {
addTask(title: String!): Task
}
type Subscription {
onAddTask: Task
@aws_subscribe(mutations: ["addTask"])
}
A client adds a task and, thanks to the subscription, every other client is notified without polling:
mutation {
addTask(title: "Write the AppSync post") {
id
title
done
}
}
The @aws_subscribe line is what wires the subscription to the mutation, so any addTask pushes the new task to subscribers automatically.
Pricing
| Item | Detail |
|---|---|
| Queries and mutations | Per million operations |
| Query and mutation rate | About $4.00 per million operations (US) |
| Real time updates | Per million updates pushed to clients |
| Connection time | Per million minutes clients stay connected |
| Free tier | 250,000 operations and 250,000 real time updates per month for 12 months |
The AWS API and app services family
AWS API and App Services
├── AppSync managed GraphQL with real time updates
├── API Gateway REST and WebSocket APIs you route yourself
├── Amplify front end hosting and app building tools
└── Lambda serverless functions behind your APIs
The main choice is AppSync versus API Gateway. AppSync is built around GraphQL and real time updates, and connects to data sources with little code. API Gateway is built around REST and WebSocket routing, giving you more manual control. For live, data driven apps, AppSync usually gets you there faster.
Wrapping up
AppSync gives you a flexible GraphQL API and real time updates without running a server or building a WebSocket layer. Define a schema, point it at your data, and changes flow to every client live. Next time an app needs live, precise data access, you know the service that skips the plumbing.
Series progress
You are on stop five of AWS Hidden Gems.
- AWS Elemental MediaConvert
- Amazon IVS
- Amazon Rekognition
- Amazon Personalize
- AWS AppSync (you are here)
- Amazon Timestream
- Amazon Textract
- Amazon Kendra
- AWS DataSync
- AWS IoT Core Next up is Amazon Timestream, a database built specifically for time series data like sensor readings and metrics.
Let's connect
Questions, corrections, or want to talk through where this fits in your own project? Reach me at khantanseer43@gmail.com.

Top comments (0)