SlideShare a Scribd company logo
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Heitor Lessa
Specialist Solutions Architect, Amazon Web Services
Building Real-time Serverless Backends
with GraphQL
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Why do we need real-time and offline
capabilities in the first place?
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Brief intro to Serverless
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Build and run
applications
without thinking about
servers
… pay per request not
for idle
“ Scales with usage
Never pay for idle
High availability
built-in
No servers
to provision
or manage
A serverless world…
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Lambda is for all application types
Analytics
Operational management
Live Dashboards
Data workflows
Content management
ETL workflows
Interactive Backends
Mobile and web apps
Webhooks and Bots
Autonomous IT
Policy engines
Infrastructure management
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Building blocks for serverless applications
AWS Lambda
Amazon DynamoDB
Amazon SNS
Amazon API Gateway Amazon SQS Amazon Kinesis
Amazon S3
Orchestration and State Management
API Management and Real-time Backend Messaging and Queues Analytics
Monitoring and Debugging
Compute Storage Database
AWS X-RayAWS Step Functions Amazon Cognito
User Management and IdP
AWS AppSync Amazon Athena
AWS Lambda@Edge
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Building blocks for serverless applications
AWS Lambda
Amazon DynamoDB
Amazon SNS
Amazon API Gateway Amazon SQS Amazon Kinesis
Amazon S3
Orchestration and State Management
API Management and Real-time Backend Messaging and Queues Analytics
Monitoring and Debugging
Compute Storage Database
AWS X-RayAWS Step Functions Amazon Cognito
User Management and IdP
AWS AppSync Amazon Athena
AWS Lambda@Edge
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Has anyone said GraphQL?
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
GraphQL APIs
Open, declarative data-fetching specification
!= Graph database
Use NoSQL, Relational, HTTP, etc.
Traditional data-fetching GraphQL
/posts
/postInfo
/postJustTitle
/postsByAuthor
/postNameStartsWithX
/commentsOnPost
/posts
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
GraphQL Spec - Schema
{
"id": "1",
"name": "Get Milk",
“priority": "1"
},
{
"id": “2",
"name": “Go to gym",
“priority": “5"
},…
type Query {
getTodos: [Todo]
}
type Todo {
id: ID!
name: String
description: String
priority: Int
duedate: String
}
query {
getTodos {
id
name
priority
}
}
Model data with
application schema
Client requests what it
needs
Only that data is
returned
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
GraphQL Spec - Types
Schema
type Event {
id: ID!
name: String
where: String
when: String
description: String
comments: [Comment]
}
type Comment {
commentId: String!
eventId: ID!
content: String!
createdAt: String!
}
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
GraphQL Spec - Mutation
Schema
Mutation
type Mutation {
createEvent(
name: String!,
when: String!,
where: String!,
description: String!
): Event
deleteEvent(id: ID!): Event
commentOnEvent(
eventId: ID!,
content: String!,
createdAt: String!
): Comment
}
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
GraphQL Spec - Query
Schema
Mutation
Query
type Query {
getEvent(id: ID!): Event
listEvents(
limit: Int,
nextToken: String
): EventConnection
}
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
GraphQL Spec - Subscription
Schema
Mutation
Query
Subscription type Subscription {
onComments(eventId: String!): Comment
@aws_subscribe(mutations: ["commentOnEvent"])
}
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
GraphQL Spec - Subscription
Schema
Mutation
Query
Subscription type Subscription {
onComments(eventId: String!): Comment
@aws_subscribe(mutations: ["commentOnEvent"])
}
type Mutation {
…
commentOnEvent(
eventId: ID!,
content: String!,
createdAt: String!
): Comment
}
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
GraphQL - Summary
Schema
Mutation
Query
Subscription
Realtime? YES
Batching? YES
Pagination? YES
Relations? YES
Aggregations? YES
Search? YES
Offline? YES
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
AWS AppSync – Intro
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
What is AWS AppSync?
AWS AppSync is a managed service for
application data using GraphQL with real-time
capabilities and an offline programming model.
Real-time
Collaboration
Offline Programming
Model with Sync
Flexible Database
Options
Fine-grained
Access Control
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
How does AWS AppSync work?
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
AWS AppSync and GraphQL Subscription
Near Realtime updates of data
Event based mode, triggered by Mutations
- Scalable model, designed as a platform for common use-cases
Can be used with ANY data source in AppSync
- Lambda, DynamoDB, Elasticsearch
mutation addPost(
id: 123
title: ”New post!”
author: ”Nadia”)
{
id
title
author
}
data: [{
id: 123,
title: ”New Post!”
author: ”Nadia”
}]
Websockets over MQTT
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
AWS AppSync – Data Sources, Auth and more
DynamoDB
Table
Lambda
Function Elasticsearch
Service
GraphQL
Schema
Upload
Schema
GraphQL
Query
Mutation
Subscription
Real-time
Offline
AppSync
API
Cognito
User Pool
Legacy
Application
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
How does AppSync connect to my data sources?
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
AWS AppSync – Debug Resolver Flow
Amazon CloudWatch logs
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
What about Offline access?
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Offline patterns – Application Considerations
• Local Storage (R/W)
• Order of Operations
• Network State Management
• UI Updates
• Conflict Resolution
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
AppSync – Debug Resolver Flow
Jane
Version : 2 Updated Document
Jane
Version : 2 Updated Document
Version : 3 Updated Document
Version : 1 New Document
Time
John
John
Jane goes offline
Jane comes back online
Version : 4 Updated Document
John
Jane
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
AWS AppSync – Conflict Resolution
Conflict resolution in the cloud
1. Server wins
2. Silent reject
3. Custom logic (AWS Lambda)
- Optimistic version check
- Extend with your own checks
Optional
• Client callback for Conflict Resolution is still
available as a fallback
{
"version" : "2017-02-28",
"operation" : "PutItem",
"key" : {
"id" : { "S" : "1" }
},
"condition" : {
"expression" : "attribute_not_exists(id)"
}
}
Example: Check that an ID doesn’t already exist:
"condition" : {
"expression" : "someExpression"
"conditionalCheckFailedHandler" : {
"strategy" : "Custom",
"lambdaArn" : "arn:..."
}
}
Run Lambda if version wrong:
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Offline best practices
• Mutations offline – what UIs actually need to be optimistic?
• Use Subscriptions appropriately
• Large payloads/paginated data: Queries
• Frequent updating deltas: Subscriptions
• Be kind to your customer’s battery & CPU!
• Don’t overcomplicate Conflict Resolution
• Data model appropriately, many app actions simply append to a list
• For custom cases, use a AWS Lambda and keep client logic light (race
conditions)
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Resources
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Additional Resources
aws.amazon.com/appsync/resources
aws-samples/
aws-mobile-appsync-chat-starter-angular
awslabs/
aws-appsync-codegen
dabit3/
vue-graphql-appsync
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Demo
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Speaker contact
Specialist Solutions Architect
Heitor Lessa
@heitor_lessa
lessa@amazon.com@
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Please complete the session survey in the
summit mobile app

More Related Content

What's hot

Iam presentation
Iam presentationIam presentation
Iam presentation
AWS UG PK
 
IAM 정책을 잘 알아야 AWS 보안도 쉬워진다. 이것은 꼭 알고 가자! - 신은수 솔루션즈 아키텍트, AWS :: AWS Summit S...
IAM 정책을 잘 알아야 AWS 보안도 쉬워진다. 이것은 꼭 알고 가자! - 신은수 솔루션즈 아키텍트, AWS :: AWS Summit S...IAM 정책을 잘 알아야 AWS 보안도 쉬워진다. 이것은 꼭 알고 가자! - 신은수 솔루션즈 아키텍트, AWS :: AWS Summit S...
IAM 정책을 잘 알아야 AWS 보안도 쉬워진다. 이것은 꼭 알고 가자! - 신은수 솔루션즈 아키텍트, AWS :: AWS Summit S...
Amazon Web Services Korea
 
Introduction to GraphQL and AWS Appsync on AWS - iOS
Introduction to GraphQL and AWS Appsync on AWS - iOSIntroduction to GraphQL and AWS Appsync on AWS - iOS
Introduction to GraphQL and AWS Appsync on AWS - iOS
Amazon Web Services
 
Amazon ElastiCache and Redis
Amazon ElastiCache and RedisAmazon ElastiCache and Redis
Amazon ElastiCache and Redis
Amazon Web Services
 
AWS System Manager: Parameter Store를 사용한 AWS 구성 데이터 관리 기법 - 정창훈, 당근마켓 / 김대권, ...
AWS System Manager: Parameter Store를 사용한 AWS 구성 데이터 관리 기법 - 정창훈, 당근마켓 / 김대권, ...AWS System Manager: Parameter Store를 사용한 AWS 구성 데이터 관리 기법 - 정창훈, 당근마켓 / 김대권, ...
AWS System Manager: Parameter Store를 사용한 AWS 구성 데이터 관리 기법 - 정창훈, 당근마켓 / 김대권, ...
Amazon Web Services Korea
 
Building a Data Lake in Amazon S3 & Amazon Glacier (STG401-R1) - AWS re:Inven...
Building a Data Lake in Amazon S3 & Amazon Glacier (STG401-R1) - AWS re:Inven...Building a Data Lake in Amazon S3 & Amazon Glacier (STG401-R1) - AWS re:Inven...
Building a Data Lake in Amazon S3 & Amazon Glacier (STG401-R1) - AWS re:Inven...
Amazon Web Services
 
Building Data Lakes for Analytics on AWS
Building Data Lakes for Analytics on AWSBuilding Data Lakes for Analytics on AWS
Building Data Lakes for Analytics on AWS
Amazon Web Services
 
Building Highly Scalable Retail Order Management Systems with Serverless
Building Highly Scalable Retail Order Management Systems with ServerlessBuilding Highly Scalable Retail Order Management Systems with Serverless
Building Highly Scalable Retail Order Management Systems with Serverless
Amazon Web Services
 
Introducing AWS AppSync: serverless data driven apps with real-time and offli...
Introducing AWS AppSync: serverless data driven apps with real-time and offli...Introducing AWS AppSync: serverless data driven apps with real-time and offli...
Introducing AWS AppSync: serverless data driven apps with real-time and offli...
Amazon Web Services
 
AWS App Mesh: Manage services mesh discovery, recovery, and monitoring - MAD3...
AWS App Mesh: Manage services mesh discovery, recovery, and monitoring - MAD3...AWS App Mesh: Manage services mesh discovery, recovery, and monitoring - MAD3...
AWS App Mesh: Manage services mesh discovery, recovery, and monitoring - MAD3...
Amazon Web Services
 
SRV403_Serverless Authentication and Authorization
SRV403_Serverless Authentication and AuthorizationSRV403_Serverless Authentication and Authorization
SRV403_Serverless Authentication and Authorization
Amazon Web Services
 
Amazon s3
Amazon s3Amazon s3
Amazon s3
android-vish
 
AWS 비용 효율화를 고려한 Reserved Instance + Savings Plan 옵션 - 박윤 어카운트 매니저 :: AWS Game...
AWS 비용 효율화를 고려한 Reserved Instance + Savings Plan 옵션 - 박윤 어카운트 매니저 :: AWS Game...AWS 비용 효율화를 고려한 Reserved Instance + Savings Plan 옵션 - 박윤 어카운트 매니저 :: AWS Game...
AWS 비용 효율화를 고려한 Reserved Instance + Savings Plan 옵션 - 박윤 어카운트 매니저 :: AWS Game...
Amazon Web Services Korea
 
AWS Lake Formation Deep Dive
AWS Lake Formation Deep DiveAWS Lake Formation Deep Dive
AWS Lake Formation Deep Dive
Cobus Bernard
 
AWS Lambda와 API Gateway를 통한 Serverless Architecture 특집 (윤석찬)
AWS Lambda와 API Gateway를 통한 Serverless Architecture 특집 (윤석찬)AWS Lambda와 API Gateway를 통한 Serverless Architecture 특집 (윤석찬)
AWS Lambda와 API Gateway를 통한 Serverless Architecture 특집 (윤석찬)
Amazon Web Services Korea
 
Cloud-native Semantic Layer on Data Lake
Cloud-native Semantic Layer on Data LakeCloud-native Semantic Layer on Data Lake
Cloud-native Semantic Layer on Data Lake
Databricks
 
ABD203_Real-Time Streaming Applications on AWS
ABD203_Real-Time Streaming Applications on AWSABD203_Real-Time Streaming Applications on AWS
ABD203_Real-Time Streaming Applications on AWS
Amazon Web Services
 
Building A Modern Data Analytics Architecture on AWS
Building A Modern Data Analytics Architecture on AWSBuilding A Modern Data Analytics Architecture on AWS
Building A Modern Data Analytics Architecture on AWS
Amazon Web Services
 
Deconstructing SaaS: Deep Dive into Building Multi-Tenant Solutions on AWS (A...
Deconstructing SaaS: Deep Dive into Building Multi-Tenant Solutions on AWS (A...Deconstructing SaaS: Deep Dive into Building Multi-Tenant Solutions on AWS (A...
Deconstructing SaaS: Deep Dive into Building Multi-Tenant Solutions on AWS (A...
Amazon Web Services
 
Building system-of-record applications with Amazon QLDB - SVC218 - New York A...
Building system-of-record applications with Amazon QLDB - SVC218 - New York A...Building system-of-record applications with Amazon QLDB - SVC218 - New York A...
Building system-of-record applications with Amazon QLDB - SVC218 - New York A...
Amazon Web Services
 

What's hot (20)

Iam presentation
Iam presentationIam presentation
Iam presentation
 
IAM 정책을 잘 알아야 AWS 보안도 쉬워진다. 이것은 꼭 알고 가자! - 신은수 솔루션즈 아키텍트, AWS :: AWS Summit S...
IAM 정책을 잘 알아야 AWS 보안도 쉬워진다. 이것은 꼭 알고 가자! - 신은수 솔루션즈 아키텍트, AWS :: AWS Summit S...IAM 정책을 잘 알아야 AWS 보안도 쉬워진다. 이것은 꼭 알고 가자! - 신은수 솔루션즈 아키텍트, AWS :: AWS Summit S...
IAM 정책을 잘 알아야 AWS 보안도 쉬워진다. 이것은 꼭 알고 가자! - 신은수 솔루션즈 아키텍트, AWS :: AWS Summit S...
 
Introduction to GraphQL and AWS Appsync on AWS - iOS
Introduction to GraphQL and AWS Appsync on AWS - iOSIntroduction to GraphQL and AWS Appsync on AWS - iOS
Introduction to GraphQL and AWS Appsync on AWS - iOS
 
Amazon ElastiCache and Redis
Amazon ElastiCache and RedisAmazon ElastiCache and Redis
Amazon ElastiCache and Redis
 
AWS System Manager: Parameter Store를 사용한 AWS 구성 데이터 관리 기법 - 정창훈, 당근마켓 / 김대권, ...
AWS System Manager: Parameter Store를 사용한 AWS 구성 데이터 관리 기법 - 정창훈, 당근마켓 / 김대권, ...AWS System Manager: Parameter Store를 사용한 AWS 구성 데이터 관리 기법 - 정창훈, 당근마켓 / 김대권, ...
AWS System Manager: Parameter Store를 사용한 AWS 구성 데이터 관리 기법 - 정창훈, 당근마켓 / 김대권, ...
 
Building a Data Lake in Amazon S3 & Amazon Glacier (STG401-R1) - AWS re:Inven...
Building a Data Lake in Amazon S3 & Amazon Glacier (STG401-R1) - AWS re:Inven...Building a Data Lake in Amazon S3 & Amazon Glacier (STG401-R1) - AWS re:Inven...
Building a Data Lake in Amazon S3 & Amazon Glacier (STG401-R1) - AWS re:Inven...
 
Building Data Lakes for Analytics on AWS
Building Data Lakes for Analytics on AWSBuilding Data Lakes for Analytics on AWS
Building Data Lakes for Analytics on AWS
 
Building Highly Scalable Retail Order Management Systems with Serverless
Building Highly Scalable Retail Order Management Systems with ServerlessBuilding Highly Scalable Retail Order Management Systems with Serverless
Building Highly Scalable Retail Order Management Systems with Serverless
 
Introducing AWS AppSync: serverless data driven apps with real-time and offli...
Introducing AWS AppSync: serverless data driven apps with real-time and offli...Introducing AWS AppSync: serverless data driven apps with real-time and offli...
Introducing AWS AppSync: serverless data driven apps with real-time and offli...
 
AWS App Mesh: Manage services mesh discovery, recovery, and monitoring - MAD3...
AWS App Mesh: Manage services mesh discovery, recovery, and monitoring - MAD3...AWS App Mesh: Manage services mesh discovery, recovery, and monitoring - MAD3...
AWS App Mesh: Manage services mesh discovery, recovery, and monitoring - MAD3...
 
SRV403_Serverless Authentication and Authorization
SRV403_Serverless Authentication and AuthorizationSRV403_Serverless Authentication and Authorization
SRV403_Serverless Authentication and Authorization
 
Amazon s3
Amazon s3Amazon s3
Amazon s3
 
AWS 비용 효율화를 고려한 Reserved Instance + Savings Plan 옵션 - 박윤 어카운트 매니저 :: AWS Game...
AWS 비용 효율화를 고려한 Reserved Instance + Savings Plan 옵션 - 박윤 어카운트 매니저 :: AWS Game...AWS 비용 효율화를 고려한 Reserved Instance + Savings Plan 옵션 - 박윤 어카운트 매니저 :: AWS Game...
AWS 비용 효율화를 고려한 Reserved Instance + Savings Plan 옵션 - 박윤 어카운트 매니저 :: AWS Game...
 
AWS Lake Formation Deep Dive
AWS Lake Formation Deep DiveAWS Lake Formation Deep Dive
AWS Lake Formation Deep Dive
 
AWS Lambda와 API Gateway를 통한 Serverless Architecture 특집 (윤석찬)
AWS Lambda와 API Gateway를 통한 Serverless Architecture 특집 (윤석찬)AWS Lambda와 API Gateway를 통한 Serverless Architecture 특집 (윤석찬)
AWS Lambda와 API Gateway를 통한 Serverless Architecture 특집 (윤석찬)
 
Cloud-native Semantic Layer on Data Lake
Cloud-native Semantic Layer on Data LakeCloud-native Semantic Layer on Data Lake
Cloud-native Semantic Layer on Data Lake
 
ABD203_Real-Time Streaming Applications on AWS
ABD203_Real-Time Streaming Applications on AWSABD203_Real-Time Streaming Applications on AWS
ABD203_Real-Time Streaming Applications on AWS
 
Building A Modern Data Analytics Architecture on AWS
Building A Modern Data Analytics Architecture on AWSBuilding A Modern Data Analytics Architecture on AWS
Building A Modern Data Analytics Architecture on AWS
 
Deconstructing SaaS: Deep Dive into Building Multi-Tenant Solutions on AWS (A...
Deconstructing SaaS: Deep Dive into Building Multi-Tenant Solutions on AWS (A...Deconstructing SaaS: Deep Dive into Building Multi-Tenant Solutions on AWS (A...
Deconstructing SaaS: Deep Dive into Building Multi-Tenant Solutions on AWS (A...
 
Building system-of-record applications with Amazon QLDB - SVC218 - New York A...
Building system-of-record applications with Amazon QLDB - SVC218 - New York A...Building system-of-record applications with Amazon QLDB - SVC218 - New York A...
Building system-of-record applications with Amazon QLDB - SVC218 - New York A...
 

Similar to Building Real-time Serverless Backends with GraphQL

Building Real-time Serverless Backends
Building Real-time Serverless BackendsBuilding Real-time Serverless Backends
Building Real-time Serverless Backends
Amazon Web Services
 
Build a Serverless Application using GraphQL & AWS AppSync
Build a Serverless Application using GraphQL & AWS AppSyncBuild a Serverless Application using GraphQL & AWS AppSync
Build a Serverless Application using GraphQL & AWS AppSync
Amazon Web Services
 
Taking your Progressive Web App to the Next Level - AWS Summit Sydney 2018
Taking your Progressive Web App to the Next Level - AWS Summit Sydney 2018Taking your Progressive Web App to the Next Level - AWS Summit Sydney 2018
Taking your Progressive Web App to the Next Level - AWS Summit Sydney 2018
Amazon Web Services
 
AppSync and GraphQL on iOS
AppSync and GraphQL on iOSAppSync and GraphQL on iOS
AppSync and GraphQL on iOS
Amazon Web Services
 
善用 GraphQL 與 AWS AppSync 讓您的 Progressive Web App (PWA) 加速進化 (Level 200)
善用  GraphQL 與 AWS AppSync 讓您的  Progressive Web App (PWA) 加速進化 (Level 200)善用  GraphQL 與 AWS AppSync 讓您的  Progressive Web App (PWA) 加速進化 (Level 200)
善用 GraphQL 與 AWS AppSync 讓您的 Progressive Web App (PWA) 加速進化 (Level 200)
Amazon Web Services
 
Building Real-Time Serverless Backends with GraphQL
Building Real-Time Serverless Backends with GraphQLBuilding Real-Time Serverless Backends with GraphQL
Building Real-Time Serverless Backends with GraphQL
Amazon Web Services
 
Taking your Progressive Web App to the Next Level with GraphQL and AWS AppSync
Taking your Progressive Web App to the Next Level with GraphQL and AWS AppSyncTaking your Progressive Web App to the Next Level with GraphQL and AWS AppSync
Taking your Progressive Web App to the Next Level with GraphQL and AWS AppSync
Amazon Web Services
 
Supercharging Applications with GraphQL and AWS AppSync
Supercharging Applications with GraphQL and AWS AppSyncSupercharging Applications with GraphQL and AWS AppSync
Supercharging Applications with GraphQL and AWS AppSync
Amazon Web Services
 
Take Mobile and Web Apps to the Next Level with AWS AppSync and AWS Amplify
Take Mobile and Web Apps to the Next Level with AWS AppSync and AWS Amplify Take Mobile and Web Apps to the Next Level with AWS AppSync and AWS Amplify
Take Mobile and Web Apps to the Next Level with AWS AppSync and AWS Amplify
Amazon Web Services
 
Developing Serverless Application on AWS
Developing Serverless Application on AWSDeveloping Serverless Application on AWS
Developing Serverless Application on AWS
Amazon Web Services
 
Ten Tips And Tricks for Improving Your GraphQL API with AWS AppSync (MOB401) ...
Ten Tips And Tricks for Improving Your GraphQL API with AWS AppSync (MOB401) ...Ten Tips And Tricks for Improving Your GraphQL API with AWS AppSync (MOB401) ...
Ten Tips And Tricks for Improving Your GraphQL API with AWS AppSync (MOB401) ...
Amazon Web Services
 
Building mobile apps that can automatically scale globally to millions of use...
Building mobile apps that can automatically scale globally to millions of use...Building mobile apps that can automatically scale globally to millions of use...
Building mobile apps that can automatically scale globally to millions of use...
AWS Germany
 
Danilo Poccia - Real-Time Serverless Backends with GraphQL - Codemotion Berli...
Danilo Poccia - Real-Time Serverless Backends with GraphQL - Codemotion Berli...Danilo Poccia - Real-Time Serverless Backends with GraphQL - Codemotion Berli...
Danilo Poccia - Real-Time Serverless Backends with GraphQL - Codemotion Berli...
Codemotion
 
Driving Innovation with Serverless Applications (GPSBUS212) - AWS re:Invent 2018
Driving Innovation with Serverless Applications (GPSBUS212) - AWS re:Invent 2018Driving Innovation with Serverless Applications (GPSBUS212) - AWS re:Invent 2018
Driving Innovation with Serverless Applications (GPSBUS212) - AWS re:Invent 2018
Amazon Web Services
 
Eliminate Migration Confusion: Speed Migration with Automated Tracking (ENT31...
Eliminate Migration Confusion: Speed Migration with Automated Tracking (ENT31...Eliminate Migration Confusion: Speed Migration with Automated Tracking (ENT31...
Eliminate Migration Confusion: Speed Migration with Automated Tracking (ENT31...
Amazon Web Services
 
Authentication & Authorization in GraphQL with AWS AppSync (MOB402) - AWS re:...
Authentication & Authorization in GraphQL with AWS AppSync (MOB402) - AWS re:...Authentication & Authorization in GraphQL with AWS AppSync (MOB402) - AWS re:...
Authentication & Authorization in GraphQL with AWS AppSync (MOB402) - AWS re:...
Amazon Web Services
 
Nader Dabit - Intro to AWS AppSync.pdf
Nader Dabit - Intro to AWS AppSync.pdfNader Dabit - Intro to AWS AppSync.pdf
Nader Dabit - Intro to AWS AppSync.pdf
Amazon Web Services
 
Building your first GraphQL API with AWS AppSync
Building your first GraphQL API with AWS AppSyncBuilding your first GraphQL API with AWS AppSync
Building your first GraphQL API with AWS AppSync
Amazon Web Services
 
Building your First GraphQL API with AWS AppSync
Building your First GraphQL API with AWS AppSyncBuilding your First GraphQL API with AWS AppSync
Building your First GraphQL API with AWS AppSync
Amazon Web Services
 
Building Real-Time Serverless Backends with GraphQL
Building Real-Time Serverless Backends with GraphQLBuilding Real-Time Serverless Backends with GraphQL
Building Real-Time Serverless Backends with GraphQL
Amazon Web Services
 

Similar to Building Real-time Serverless Backends with GraphQL (20)

Building Real-time Serverless Backends
Building Real-time Serverless BackendsBuilding Real-time Serverless Backends
Building Real-time Serverless Backends
 
Build a Serverless Application using GraphQL & AWS AppSync
Build a Serverless Application using GraphQL & AWS AppSyncBuild a Serverless Application using GraphQL & AWS AppSync
Build a Serverless Application using GraphQL & AWS AppSync
 
Taking your Progressive Web App to the Next Level - AWS Summit Sydney 2018
Taking your Progressive Web App to the Next Level - AWS Summit Sydney 2018Taking your Progressive Web App to the Next Level - AWS Summit Sydney 2018
Taking your Progressive Web App to the Next Level - AWS Summit Sydney 2018
 
AppSync and GraphQL on iOS
AppSync and GraphQL on iOSAppSync and GraphQL on iOS
AppSync and GraphQL on iOS
 
善用 GraphQL 與 AWS AppSync 讓您的 Progressive Web App (PWA) 加速進化 (Level 200)
善用  GraphQL 與 AWS AppSync 讓您的  Progressive Web App (PWA) 加速進化 (Level 200)善用  GraphQL 與 AWS AppSync 讓您的  Progressive Web App (PWA) 加速進化 (Level 200)
善用 GraphQL 與 AWS AppSync 讓您的 Progressive Web App (PWA) 加速進化 (Level 200)
 
Building Real-Time Serverless Backends with GraphQL
Building Real-Time Serverless Backends with GraphQLBuilding Real-Time Serverless Backends with GraphQL
Building Real-Time Serverless Backends with GraphQL
 
Taking your Progressive Web App to the Next Level with GraphQL and AWS AppSync
Taking your Progressive Web App to the Next Level with GraphQL and AWS AppSyncTaking your Progressive Web App to the Next Level with GraphQL and AWS AppSync
Taking your Progressive Web App to the Next Level with GraphQL and AWS AppSync
 
Supercharging Applications with GraphQL and AWS AppSync
Supercharging Applications with GraphQL and AWS AppSyncSupercharging Applications with GraphQL and AWS AppSync
Supercharging Applications with GraphQL and AWS AppSync
 
Take Mobile and Web Apps to the Next Level with AWS AppSync and AWS Amplify
Take Mobile and Web Apps to the Next Level with AWS AppSync and AWS Amplify Take Mobile and Web Apps to the Next Level with AWS AppSync and AWS Amplify
Take Mobile and Web Apps to the Next Level with AWS AppSync and AWS Amplify
 
Developing Serverless Application on AWS
Developing Serverless Application on AWSDeveloping Serverless Application on AWS
Developing Serverless Application on AWS
 
Ten Tips And Tricks for Improving Your GraphQL API with AWS AppSync (MOB401) ...
Ten Tips And Tricks for Improving Your GraphQL API with AWS AppSync (MOB401) ...Ten Tips And Tricks for Improving Your GraphQL API with AWS AppSync (MOB401) ...
Ten Tips And Tricks for Improving Your GraphQL API with AWS AppSync (MOB401) ...
 
Building mobile apps that can automatically scale globally to millions of use...
Building mobile apps that can automatically scale globally to millions of use...Building mobile apps that can automatically scale globally to millions of use...
Building mobile apps that can automatically scale globally to millions of use...
 
Danilo Poccia - Real-Time Serverless Backends with GraphQL - Codemotion Berli...
Danilo Poccia - Real-Time Serverless Backends with GraphQL - Codemotion Berli...Danilo Poccia - Real-Time Serverless Backends with GraphQL - Codemotion Berli...
Danilo Poccia - Real-Time Serverless Backends with GraphQL - Codemotion Berli...
 
Driving Innovation with Serverless Applications (GPSBUS212) - AWS re:Invent 2018
Driving Innovation with Serverless Applications (GPSBUS212) - AWS re:Invent 2018Driving Innovation with Serverless Applications (GPSBUS212) - AWS re:Invent 2018
Driving Innovation with Serverless Applications (GPSBUS212) - AWS re:Invent 2018
 
Eliminate Migration Confusion: Speed Migration with Automated Tracking (ENT31...
Eliminate Migration Confusion: Speed Migration with Automated Tracking (ENT31...Eliminate Migration Confusion: Speed Migration with Automated Tracking (ENT31...
Eliminate Migration Confusion: Speed Migration with Automated Tracking (ENT31...
 
Authentication & Authorization in GraphQL with AWS AppSync (MOB402) - AWS re:...
Authentication & Authorization in GraphQL with AWS AppSync (MOB402) - AWS re:...Authentication & Authorization in GraphQL with AWS AppSync (MOB402) - AWS re:...
Authentication & Authorization in GraphQL with AWS AppSync (MOB402) - AWS re:...
 
Nader Dabit - Intro to AWS AppSync.pdf
Nader Dabit - Intro to AWS AppSync.pdfNader Dabit - Intro to AWS AppSync.pdf
Nader Dabit - Intro to AWS AppSync.pdf
 
Building your first GraphQL API with AWS AppSync
Building your first GraphQL API with AWS AppSyncBuilding your first GraphQL API with AWS AppSync
Building your first GraphQL API with AWS AppSync
 
Building your First GraphQL API with AWS AppSync
Building your First GraphQL API with AWS AppSyncBuilding your First GraphQL API with AWS AppSync
Building your First GraphQL API with AWS AppSync
 
Building Real-Time Serverless Backends with GraphQL
Building Real-Time Serverless Backends with GraphQLBuilding Real-Time Serverless Backends with GraphQL
Building Real-Time Serverless Backends with GraphQL
 

More from Amazon Web Services

Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...
Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...
Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...
Amazon Web Services
 
Big Data per le Startup: come creare applicazioni Big Data in modalità Server...
Big Data per le Startup: come creare applicazioni Big Data in modalità Server...Big Data per le Startup: come creare applicazioni Big Data in modalità Server...
Big Data per le Startup: come creare applicazioni Big Data in modalità Server...
Amazon Web Services
 
Esegui pod serverless con Amazon EKS e AWS Fargate
Esegui pod serverless con Amazon EKS e AWS FargateEsegui pod serverless con Amazon EKS e AWS Fargate
Esegui pod serverless con Amazon EKS e AWS Fargate
Amazon Web Services
 
Costruire Applicazioni Moderne con AWS
Costruire Applicazioni Moderne con AWSCostruire Applicazioni Moderne con AWS
Costruire Applicazioni Moderne con AWS
Amazon Web Services
 
Come spendere fino al 90% in meno con i container e le istanze spot
Come spendere fino al 90% in meno con i container e le istanze spot Come spendere fino al 90% in meno con i container e le istanze spot
Come spendere fino al 90% in meno con i container e le istanze spot
Amazon Web Services
 
Open banking as a service
Open banking as a serviceOpen banking as a service
Open banking as a service
Amazon Web Services
 
Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...
Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...
Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...
Amazon Web Services
 
OpsWorks Configuration Management: automatizza la gestione e i deployment del...
OpsWorks Configuration Management: automatizza la gestione e i deployment del...OpsWorks Configuration Management: automatizza la gestione e i deployment del...
OpsWorks Configuration Management: automatizza la gestione e i deployment del...
Amazon Web Services
 
Microsoft Active Directory su AWS per supportare i tuoi Windows Workloads
Microsoft Active Directory su AWS per supportare i tuoi Windows WorkloadsMicrosoft Active Directory su AWS per supportare i tuoi Windows Workloads
Microsoft Active Directory su AWS per supportare i tuoi Windows Workloads
Amazon Web Services
 
Computer Vision con AWS
Computer Vision con AWSComputer Vision con AWS
Computer Vision con AWS
Amazon Web Services
 
Database Oracle e VMware Cloud on AWS i miti da sfatare
Database Oracle e VMware Cloud on AWS i miti da sfatareDatabase Oracle e VMware Cloud on AWS i miti da sfatare
Database Oracle e VMware Cloud on AWS i miti da sfatare
Amazon Web Services
 
Crea la tua prima serverless ledger-based app con QLDB e NodeJS
Crea la tua prima serverless ledger-based app con QLDB e NodeJSCrea la tua prima serverless ledger-based app con QLDB e NodeJS
Crea la tua prima serverless ledger-based app con QLDB e NodeJS
Amazon Web Services
 
API moderne real-time per applicazioni mobili e web
API moderne real-time per applicazioni mobili e webAPI moderne real-time per applicazioni mobili e web
API moderne real-time per applicazioni mobili e web
Amazon Web Services
 
Database Oracle e VMware Cloud™ on AWS: i miti da sfatare
Database Oracle e VMware Cloud™ on AWS: i miti da sfatareDatabase Oracle e VMware Cloud™ on AWS: i miti da sfatare
Database Oracle e VMware Cloud™ on AWS: i miti da sfatare
Amazon Web Services
 
Tools for building your MVP on AWS
Tools for building your MVP on AWSTools for building your MVP on AWS
Tools for building your MVP on AWSAmazon Web Services
 
How to Build a Winning Pitch Deck
How to Build a Winning Pitch DeckHow to Build a Winning Pitch Deck
How to Build a Winning Pitch DeckAmazon Web Services
 
Building a web application without servers
Building a web application without serversBuilding a web application without servers
Building a web application without serversAmazon Web Services
 
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...Amazon Web Services
 
Introduzione a Amazon Elastic Container Service
Introduzione a Amazon Elastic Container ServiceIntroduzione a Amazon Elastic Container Service
Introduzione a Amazon Elastic Container Service
Amazon Web Services
 

More from Amazon Web Services (20)

Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...
Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...
Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...
 
Big Data per le Startup: come creare applicazioni Big Data in modalità Server...
Big Data per le Startup: come creare applicazioni Big Data in modalità Server...Big Data per le Startup: come creare applicazioni Big Data in modalità Server...
Big Data per le Startup: come creare applicazioni Big Data in modalità Server...
 
Esegui pod serverless con Amazon EKS e AWS Fargate
Esegui pod serverless con Amazon EKS e AWS FargateEsegui pod serverless con Amazon EKS e AWS Fargate
Esegui pod serverless con Amazon EKS e AWS Fargate
 
Costruire Applicazioni Moderne con AWS
Costruire Applicazioni Moderne con AWSCostruire Applicazioni Moderne con AWS
Costruire Applicazioni Moderne con AWS
 
Come spendere fino al 90% in meno con i container e le istanze spot
Come spendere fino al 90% in meno con i container e le istanze spot Come spendere fino al 90% in meno con i container e le istanze spot
Come spendere fino al 90% in meno con i container e le istanze spot
 
Open banking as a service
Open banking as a serviceOpen banking as a service
Open banking as a service
 
Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...
Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...
Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...
 
OpsWorks Configuration Management: automatizza la gestione e i deployment del...
OpsWorks Configuration Management: automatizza la gestione e i deployment del...OpsWorks Configuration Management: automatizza la gestione e i deployment del...
OpsWorks Configuration Management: automatizza la gestione e i deployment del...
 
Microsoft Active Directory su AWS per supportare i tuoi Windows Workloads
Microsoft Active Directory su AWS per supportare i tuoi Windows WorkloadsMicrosoft Active Directory su AWS per supportare i tuoi Windows Workloads
Microsoft Active Directory su AWS per supportare i tuoi Windows Workloads
 
Computer Vision con AWS
Computer Vision con AWSComputer Vision con AWS
Computer Vision con AWS
 
Database Oracle e VMware Cloud on AWS i miti da sfatare
Database Oracle e VMware Cloud on AWS i miti da sfatareDatabase Oracle e VMware Cloud on AWS i miti da sfatare
Database Oracle e VMware Cloud on AWS i miti da sfatare
 
Crea la tua prima serverless ledger-based app con QLDB e NodeJS
Crea la tua prima serverless ledger-based app con QLDB e NodeJSCrea la tua prima serverless ledger-based app con QLDB e NodeJS
Crea la tua prima serverless ledger-based app con QLDB e NodeJS
 
API moderne real-time per applicazioni mobili e web
API moderne real-time per applicazioni mobili e webAPI moderne real-time per applicazioni mobili e web
API moderne real-time per applicazioni mobili e web
 
Database Oracle e VMware Cloud™ on AWS: i miti da sfatare
Database Oracle e VMware Cloud™ on AWS: i miti da sfatareDatabase Oracle e VMware Cloud™ on AWS: i miti da sfatare
Database Oracle e VMware Cloud™ on AWS: i miti da sfatare
 
Tools for building your MVP on AWS
Tools for building your MVP on AWSTools for building your MVP on AWS
Tools for building your MVP on AWS
 
How to Build a Winning Pitch Deck
How to Build a Winning Pitch DeckHow to Build a Winning Pitch Deck
How to Build a Winning Pitch Deck
 
Building a web application without servers
Building a web application without serversBuilding a web application without servers
Building a web application without servers
 
Fundraising Essentials
Fundraising EssentialsFundraising Essentials
Fundraising Essentials
 
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
 
Introduzione a Amazon Elastic Container Service
Introduzione a Amazon Elastic Container ServiceIntroduzione a Amazon Elastic Container Service
Introduzione a Amazon Elastic Container Service
 

Building Real-time Serverless Backends with GraphQL

  • 1. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Heitor Lessa Specialist Solutions Architect, Amazon Web Services Building Real-time Serverless Backends with GraphQL
  • 2. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Why do we need real-time and offline capabilities in the first place?
  • 3. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Brief intro to Serverless
  • 4. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
  • 5. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Build and run applications without thinking about servers … pay per request not for idle “ Scales with usage Never pay for idle High availability built-in No servers to provision or manage A serverless world…
  • 6. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Lambda is for all application types Analytics Operational management Live Dashboards Data workflows Content management ETL workflows Interactive Backends Mobile and web apps Webhooks and Bots Autonomous IT Policy engines Infrastructure management
  • 7. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Building blocks for serverless applications AWS Lambda Amazon DynamoDB Amazon SNS Amazon API Gateway Amazon SQS Amazon Kinesis Amazon S3 Orchestration and State Management API Management and Real-time Backend Messaging and Queues Analytics Monitoring and Debugging Compute Storage Database AWS X-RayAWS Step Functions Amazon Cognito User Management and IdP AWS AppSync Amazon Athena AWS Lambda@Edge
  • 8. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Building blocks for serverless applications AWS Lambda Amazon DynamoDB Amazon SNS Amazon API Gateway Amazon SQS Amazon Kinesis Amazon S3 Orchestration and State Management API Management and Real-time Backend Messaging and Queues Analytics Monitoring and Debugging Compute Storage Database AWS X-RayAWS Step Functions Amazon Cognito User Management and IdP AWS AppSync Amazon Athena AWS Lambda@Edge
  • 9. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Has anyone said GraphQL?
  • 10. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. GraphQL APIs Open, declarative data-fetching specification != Graph database Use NoSQL, Relational, HTTP, etc. Traditional data-fetching GraphQL /posts /postInfo /postJustTitle /postsByAuthor /postNameStartsWithX /commentsOnPost /posts
  • 11. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. GraphQL Spec - Schema { "id": "1", "name": "Get Milk", “priority": "1" }, { "id": “2", "name": “Go to gym", “priority": “5" },… type Query { getTodos: [Todo] } type Todo { id: ID! name: String description: String priority: Int duedate: String } query { getTodos { id name priority } } Model data with application schema Client requests what it needs Only that data is returned
  • 12. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. GraphQL Spec - Types Schema type Event { id: ID! name: String where: String when: String description: String comments: [Comment] } type Comment { commentId: String! eventId: ID! content: String! createdAt: String! }
  • 13. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. GraphQL Spec - Mutation Schema Mutation type Mutation { createEvent( name: String!, when: String!, where: String!, description: String! ): Event deleteEvent(id: ID!): Event commentOnEvent( eventId: ID!, content: String!, createdAt: String! ): Comment }
  • 14. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. GraphQL Spec - Query Schema Mutation Query type Query { getEvent(id: ID!): Event listEvents( limit: Int, nextToken: String ): EventConnection }
  • 15. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. GraphQL Spec - Subscription Schema Mutation Query Subscription type Subscription { onComments(eventId: String!): Comment @aws_subscribe(mutations: ["commentOnEvent"]) }
  • 16. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. GraphQL Spec - Subscription Schema Mutation Query Subscription type Subscription { onComments(eventId: String!): Comment @aws_subscribe(mutations: ["commentOnEvent"]) } type Mutation { … commentOnEvent( eventId: ID!, content: String!, createdAt: String! ): Comment }
  • 17. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. GraphQL - Summary Schema Mutation Query Subscription Realtime? YES Batching? YES Pagination? YES Relations? YES Aggregations? YES Search? YES Offline? YES
  • 18. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. AWS AppSync – Intro
  • 19. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. What is AWS AppSync? AWS AppSync is a managed service for application data using GraphQL with real-time capabilities and an offline programming model. Real-time Collaboration Offline Programming Model with Sync Flexible Database Options Fine-grained Access Control
  • 20. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. How does AWS AppSync work?
  • 21. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. AWS AppSync and GraphQL Subscription Near Realtime updates of data Event based mode, triggered by Mutations - Scalable model, designed as a platform for common use-cases Can be used with ANY data source in AppSync - Lambda, DynamoDB, Elasticsearch mutation addPost( id: 123 title: ”New post!” author: ”Nadia”) { id title author } data: [{ id: 123, title: ”New Post!” author: ”Nadia” }] Websockets over MQTT
  • 22. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. AWS AppSync – Data Sources, Auth and more DynamoDB Table Lambda Function Elasticsearch Service GraphQL Schema Upload Schema GraphQL Query Mutation Subscription Real-time Offline AppSync API Cognito User Pool Legacy Application
  • 23. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. How does AppSync connect to my data sources?
  • 24. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. AWS AppSync – Debug Resolver Flow Amazon CloudWatch logs
  • 25. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. What about Offline access?
  • 26. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Offline patterns – Application Considerations • Local Storage (R/W) • Order of Operations • Network State Management • UI Updates • Conflict Resolution
  • 27. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. AppSync – Debug Resolver Flow Jane Version : 2 Updated Document Jane Version : 2 Updated Document Version : 3 Updated Document Version : 1 New Document Time John John Jane goes offline Jane comes back online Version : 4 Updated Document John Jane
  • 28. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. AWS AppSync – Conflict Resolution Conflict resolution in the cloud 1. Server wins 2. Silent reject 3. Custom logic (AWS Lambda) - Optimistic version check - Extend with your own checks Optional • Client callback for Conflict Resolution is still available as a fallback { "version" : "2017-02-28", "operation" : "PutItem", "key" : { "id" : { "S" : "1" } }, "condition" : { "expression" : "attribute_not_exists(id)" } } Example: Check that an ID doesn’t already exist: "condition" : { "expression" : "someExpression" "conditionalCheckFailedHandler" : { "strategy" : "Custom", "lambdaArn" : "arn:..." } } Run Lambda if version wrong:
  • 29. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Offline best practices • Mutations offline – what UIs actually need to be optimistic? • Use Subscriptions appropriately • Large payloads/paginated data: Queries • Frequent updating deltas: Subscriptions • Be kind to your customer’s battery & CPU! • Don’t overcomplicate Conflict Resolution • Data model appropriately, many app actions simply append to a list • For custom cases, use a AWS Lambda and keep client logic light (race conditions)
  • 30. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Resources
  • 31. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Additional Resources aws.amazon.com/appsync/resources aws-samples/ aws-mobile-appsync-chat-starter-angular awslabs/ aws-appsync-codegen dabit3/ vue-graphql-appsync
  • 32. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Demo
  • 33. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Speaker contact Specialist Solutions Architect Heitor Lessa @heitor_lessa lessa@amazon.com@
  • 34. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Please complete the session survey in the summit mobile app