Serverless GraphQL API on AWS
AppSync routes GraphQL operations to Lambda resolvers that write DynamoDB and query OpenSearch, while a separate stream-driven indexer keeps the search read model current.
Explore diagramOpen editable diagramExplore on mobile. Create and edit manually or with AI on a computer.
Architecture diagram
Explore diagramEdit this exact diagram
Explore diagramOpen on the canvasGraphQL AWS diagram with AppSync, Lambda resolvers writing DynamoDB and reading OpenSearch, and a DynamoDB Streams indexing path. Open the image to explore this ready-made diagram.The image links to a fully editable BuildPlane starter.
Overview
Application clients send GraphQL operations to AWS AppSync, which invokes Lambda resolvers for domain logic. Mutations write authoritative records to DynamoDB, while search requests read OpenSearch. DynamoDB Streams feeds a separate Lambda indexer that updates the search projection asynchronously.
Components
- AppSync and Lambda resolvers: AppSync exposes the GraphQL surface while Lambda handles domain-specific mutations and search queries.
- DynamoDB and Streams: The table is authoritative and its stream emits ordered change records for downstream projections.
- Indexer and OpenSearch: A separate Lambda consumer builds a search-optimized read model queried by the API resolvers.
GraphQL and Indexing Flow
- Clients send GraphQL operations to AppSync.
- Lambda resolvers apply business rules and write authoritative records to DynamoDB.
- DynamoDB Streams invokes the indexer, which updates the OpenSearch read model.
- Search operations read OpenSearch through the resolvers, with asynchronous indexing lag kept explicit.
Customize First
- Choose direct AppSync resolvers where Lambda adds no business value.
- Design stream retry and replay behavior so the search index can be rebuilt safely.
- Add Cognito or another supported authorizer with field-level access rules.
Related AWS guides
Understand the decisions behind this diagram
Use these practical explanations to compare services, failure boundaries, and operating tradeoffs before adapting the architecture.
Design rationale
Decisions that shape this architecture
Put the GraphQL contract at AppSync
AppSync owns schema validation, authorization integration, resolver execution, and subscriptions instead of rebuilding those concerns in a generic HTTP service.
Keep DynamoDB authoritative
Mutations commit to DynamoDB first. Search remains an asynchronous projection that can lag or be rebuilt without becoming the source of transactional truth.
Index from the table stream
DynamoDB Streams decouples search indexing from client latency and preserves ordered item changes for retryable consumers.
Before production
Operational checks
Test schema authorization for every object, field, tenant, and mutation path.
Alarm on resolver errors, throttling, stream iterator age, and failed index updates.
Make the indexer idempotent and document a full search-index rebuild procedure.
Track GraphQL query complexity, latency, DynamoDB access patterns, and search freshness.
Scope and tradeoffs
What this diagram does not solve
Search is eventually consistent
A successful mutation can be visible in DynamoDB before the OpenSearch projection updates. The user experience must tolerate that delay.
Lambda is not always needed for every resolver
Direct AppSync resolvers may be simpler for straightforward data access. Keep Lambda only where domain logic or integration behavior justifies it.
Common questions
Frequently asked questions
Why use DynamoDB Streams for OpenSearch indexing?
The stream emits table changes asynchronously, allowing search documents to update without adding OpenSearch latency or failures to the mutation request.
Can AppSync call DynamoDB directly?
Yes. Direct resolvers can reduce cost and latency for simple access patterns. Lambda is useful when requests need richer domain logic or coordination.
How is the OpenSearch index rebuilt?
Use a controlled backfill from DynamoDB or an exported snapshot, then resume stream processing from a known checkpoint and reconcile missed updates.
Keep exploring
Related AWS architectures

Serverless REST API Architecture on AWS
This is the serverless API baseline that most production APIs grow from rather than away from: a managed HTTPS entry point, stateless function compute, on-demand data storage, and observable execution. It is deliberately compact so the first real decisions stay legible. Adding authentication, caching, asynchronous work, and a second Region each attaches to this shape without replacing it, which is why it is worth understanding before the additions arrive.
Explore the architecture
Generative AI RAG Assistant on AWS
This retrieval-augmented generation architecture separates the API contract, orchestration logic, owned knowledge, vector search, and foundation model. It provides a clear baseline for grounding model responses in private documents while keeping chunking, embedding selection, evaluation, authorization, and conversation storage as explicit next decisions.
Explore the architecture
Serverless Multi-Tenant SaaS Architecture on AWS
This architecture combines a protected synchronous API with a durable asynchronous work path. Tenant identity travels from Cognito into application authorization, domain events decouple background work, and DynamoDB plus S3 provide scalable tenant state and assets.
Explore the architectureReady-made AWS diagramFrom reference to working draft
Explore this AWS architectureAdapt this architecture with your AWS AI Agent
Open the diagram from this guide and explore how it works. Create and edit manually or with AI on a computer.Start from the exact diagram in this guide. Change requirements, challenge a decision, or ask what fails first, while keeping the architecture editable.