AWS AppSync resolver mapping template utility reference
Note
We now primarily support the APPSYNC_JS runtime and its documentation. Please consider using the APPSYNC_JS runtime and its guides here.
AWS AppSync defines a set of utilities that you can use within a GraphQL resolver to simplify interactions with data sources. Some of these utilities are for general use with any data source, such as generating IDs or timestamps. Others are specific to a type of data source. The following utilities are available:
-
Utility helpers in $util - The $util variable contains general utility methods to help you work with data. Unless otherwise specified, all utilities use the UTF-8 character set.
-
AppSync directives - AppSync exposes directives to facilitate developer productivity when writing in VTL.
-
Time helpers in $util.time - The $util.time variable contains datetime methods to help generate timestamps, convert between datetime formats, and parse datetime strings. The syntax for datetime formats is based on DateTimeFormatter
, which you can reference for further documentation. -
List helpers in $util.list - $util.list contains methods to help with common List operations such as removing or retaining items from a list for filtering use cases.
-
Map helpers in $util.map - $util.map contains methods to help with common Map operations such as removing or retaining items from a Map for filtering use cases.
-
DynamoDB helpers in $util.dynamodb - $util.dynamodb contains helper methods that make it easier to write and read data to Amazon DynamoDB, such as automatic type mapping and formatting.
-
Amazon RDS helpers in $util.rds - $util.rds contains helper methods that format RDS operations by getting rid of extraneous data in result outputs.
-
HTTP helpers in $util.http - The $util.http utility provides helper methods that you can use to manage HTTP request parameters and to add response headers.
-
XML helpers in $util.xml - $util.xml contains helper methods that can make it easier to translate XML responses to JSON or a Dictionary.
-
Transformation helpers in $util.transform - $util.transform contains helper methods that make it easier to perform complex operations against data sources, such as DynamoDB filter operations.
-
Math helpers in $util.math - $util.math contains methods to help with common Math operations.
-
String helpers in $util.str - $util.str contains methods to help with common String operations.
-
Extensions - $extensions contains a set of methods to make additional actions within your resolvers.