AWS AppSync AWS AppSync Developer Guide
Make your application realtime .......................................................................................... 31
Complex Objects .............................................................................................................. 32
Conflict Resolution ........................................................................................................... 35
Building a React Native Client App ............................................................................................ 36
Before You Begin ............................................................................................................. 20
Get the GraphQL API Endpoint .......................................................................................... 21
Create a React Native Application ....................................................................................... 37
Import the AWS AppSync SDK Into Your App ....................................................................... 25
Test Your Application ........................................................................................................ 30
Offline Settings ................................................................................................................ 30
Make your application realtime .......................................................................................... 31
Conflict Resolution ........................................................................................................... 35
Building a JavaScript Client App ................................................................................................ 50
Before You Begin ............................................................................................................. 20
Get the GraphQL API Endpoint .......................................................................................... 21
Create a Client Application ................................................................................................ 21
Building an iOS Client App ....................................................................................................... 54
Create an API ................................................................................................................... 54
Download a Client Application ........................................................................................... 55
Set up the code generation for GraphQLOperations .............................................................. 55
Setup dependency on AWS AppSync SDK ............................................................................ 57
Convert the app to use AWS AppSync for Backend ............................................................... 58
Make your app Real Time .................................................................................................. 62
Integrating into the build process ....................................................................................... 63
Complex Objects .............................................................................................................. 32
Conflict Resolution ........................................................................................................... 35
Integrating with CloudWatch ............................................................................................................ 67
Getting CloudWatch Metrics (CLI) ............................................................................................... 67
AWS AppSync Metrics ............................................................................................................... 67
AWS AppSync Dimensions ......................................................................................................... 68
Data Sources and Resolvers .............................................................................................................. 69
Tutorial: DynamoDB Resolvers .................................................................................................. 69
Setting up your DynamoDB tables ...................................................................................... 69
Creating Your GraphQL API ............................................................................................... 70
Defining a Basic "Post" API ................................................................................................ 70
Configuring the Datasource for the DynamoDB Tables .......................................................... 71
Setting up the "addPost" resolver (DynamoDB PutItem) ........................................................ 71
Setting up the "getPost" resolver (DynamoDB GetItem) ......................................................... 74
Create an updatePost mutation (DynamoDB UpdateItem) ...................................................... 76
Modifying the "updatePost" resolver (DynamoDB UpdateItem) ............................................... 78
Create upvotePost and downvotePost mutations (DynamoDB UpdateItem) .............................. 82
Setting up the "deletePost" resolver (DynamoDB DeletePost) ................................................. 85
Setting up the "allPost" resolver (DynamoDB Scan) ............................................................... 89
Setting up the "allPostsByAuthor" resolver (DynamoDB Query) ............................................... 93
Using Sets ....................................................................................................................... 96
Using Lists and Maps ...................................................................................................... 102
Conclusion ..................................................................................................................... 104
Tutorial: Lambda resolvers ...................................................................................................... 104
Create a Lambda function ............................................................................................... 104
Configure data source for AWS Lambda ............................................................................ 106
Creating a GraphQL Schema ............................................................................................ 106
Configuring resolvers ........................................................................................................ 15
Testing your GraphQL API ............................................................................................... 108
Returning Errors ............................................................................................................. 109
Advanced Use Case: Batching ........................................................................................... 111
Tutorial: Amazon Elasticsearch Service Resolvers ....................................................................... 116
Create a New Amazon ES Domain .................................................................................... 116
iv