Build VTL and JavaScript resolver mapping templates for AppSync GraphQL.
Last verified: May 2026
Build VTL and JavaScript resolver mapping templates for AppSync GraphQL.
Required Fields
resolverNamedataSourcerequestTemplaterequestTemplate.versionresponseTemplateOutput will appear here...The AppSync Resolver Builder helps you construct AWS AppSync VTL (Velocity Template Language) resolver mapping templates for connecting GraphQL operations to data sources. VTL resolvers map GraphQL requests to DynamoDB, Lambda, Elasticsearch, RDS, and HTTP data sources. This tool provides templates for common resolver patterns and guides you through building request and response mapping templates with the correct VTL syntax and utility functions.
AWS AppSync now supports JavaScript resolvers as an alternative to VTL. JavaScript resolvers are generally easier to write and test. However, VTL resolvers are still widely used in existing projects and are fully supported. Choose based on your team's expertise and project requirements.
AppSync resolvers support DynamoDB, Lambda, OpenSearch (Elasticsearch), Aurora Serverless (via RDS Data API), HTTP endpoints, and EventBridge. Each data source type has its own VTL utility functions and request/response patterns.
Your team's GraphQL API has a `getOrder(orderId)` query that hits DynamoDB. The naive VTL resolver was written 3 years ago and has hardcoded values, no error handling, and a race condition with auth checks. The builder helps you migrate to a JavaScript pipeline resolver: function 1 = auth check (Lambda), function 2 = DynamoDB GetItem with the authorized fields. Cleaner code, easier to test, same latency. As a bonus, the JS version logs to CloudWatch with proper correlation IDs.
The builder generates resolver mapping templates for AWS AppSync. For VTL resolvers, it produces request and response templates targeting the chosen data source (DynamoDB, Lambda, OpenSearch, RDS via Data API, HTTP). For JavaScript resolvers, it generates request/response handlers using the APPSYNC_JS runtime utilities. Each output includes the data source binding and the GraphQL field path it should attach to.
JavaScript resolvers (APPSYNC_JS runtime) are the right default in 2026 for new AppSync projects. They're easier to write, easier to debug locally, and have better tooling than VTL. The migration story from VTL to JS is good — convert resolvers gradually rather than rewriting all at once.
Pipeline resolvers let you chain multiple data sources in one GraphQL field — useful for authorization checks (call IAM, then DynamoDB) without round-trips to the client. But each step adds latency, and complex pipelines become hard to debug. Limit pipelines to 2-3 functions when possible.
Caching at the resolver level can dramatically reduce DynamoDB costs for read-heavy GraphQL APIs. AppSync supports per-resolver caching with TTL — enable it for queries with high cache hit rates (e.g., 'list categories' that change rarely). Caching is per-resolver, not per-query, so you have fine control.
Was this tool helpful?
Disclaimer: This tool runs entirely in your browser. No data is sent to our servers. Always verify outputs before using them in production. AWS, Azure, and GCP are trademarks of their respective owners.