SlideShare a Scribd company logo
GraphQL AppSync 101
Agenda
Plan
What is AppSync?
What can you use it for?
What is it made of?
AWS AppSync types
Subscriptions
Security
Monitoring and logging
Pricing
Demo - existing data sources
Final thoughts
How to prototype really fast
2
What is AppSync?
AWS service that enables developers to easily build products
based on GraphQL.
Out of the box it supports many AWS products including:
● data storages
● lambdas
● cloud security
1
3
What can you use it for?2
4
What can you use it for?
Use cases:
◦ Exposing GraphQL API
◦ Real-time interaction applications
▫ Chats
▫ Collaboration
▫ News feed etc.
5
What is made of?3
6
Processing
7
Engine for:
◦ Security
◦ Processing requests
◦ Subscriptions
◦ Batch processes
Black box for developer.
GraphQL Proxy
8
GraphQL schema describing API contract
Schema
9
Types
◦ ID
◦ String
◦ Int
◦ Float
◦ Boolean
◦ AWSDate
◦ AWSTime
◦ AWSDateTime
◦ AWSTimestamp
◦ AWSEmail - Valid RFC 822
◦ AWSJSON - Valid RFC 8259
◦ AWSURL - Valid URL
◦ AWSPhone - Valid phone number (no spec in docs)
◦ AWSIPAddress - Valid IPv4 or IPv6
10
Types
AppSync supports interfaces and unions.
The caveat here is that you have to do is to append
‘__typename’ for type resolution
#foreach ($result in $context.result)
## Extract type name from the id field.
#set( $typeName = $result.id.split("-")[0] )
#set( $ignore = $result.put("__typename", $typeName))
#end
$util.toJson($context.result)
11
Data Sources
DynamoDB
AWS NoSQL
Elasticsearch
Search engine
Lambda
AWS Lambda function
RDS
Aurora - Relational Database
from AWS
HTTP
Any root http endpoint
None
Internal logic
12
Usually in GraphQL:
Responsible for serving requested data by field.
In AppSync:
Transforming request to data source request
and mapping data source response.
Resolvers
13
Unit resolver performs single operation on data
source.
It can also be a batch operation. But not for all
data sources. Supports DynamoDB and
Lambda.
Unit resolver
14
Allows executing
multiple operations
against one or more
data sources.
Composed of a list of
functions. Each
function is executed
in sequence and can
execute a single
operation on a data
source.
Pipeline resolver
15
Example use cases
◦ Load and transform fields based on the
requested format
◦ Custom roles setup application
Pipeline resolver
16
◦ $ctx.stash
◦ $ctx.prev.result
◦ #return(data: Object) - breaks mapping template
with data
◦ $util.error - breaks execution with error
◦ $util.appendError - marks error without
interruption
Pipeline utilities
17
Functions are single operations for redundant
logic on the GraphQL Proxy as a part of
pipeline resolvers.
It can be our customer role check from previous
section
Functions
18
#set($validMinPrice =
$util.matches("d{1,3}[,.]?(d{1,2})?",$ctx.args.minPrice))
#if (!$validMinPrice)
$util.error("Provided price input is not valid.")
#end
{
"version": "2018-05-29",
"statements": [
"select * from Pets where price > :MIN"
],
"variableMap": {
":MIN": $ctx.args.minPrice
}
}
Functions
19
Testing and debugging resolvers
20
Subscription at scale for datasources not
supporting this feature.
AWS takes heavy-lifting and after successful
mutation it pushes notification to all subscribers
for you.
Subscriptions
21
Security4
22
Security
Cognito/OpenID
AWS auth service
supporting
standards like
◦ OAuth 2.0
◦ SAML 2.0
◦ OpenID Connect
OpenID Docs
IAM
For other AWS
services and users,
permissions per
resource / field
API KEY
Constant key sent
over x-api-key
header
23
Cognito
24
Cognito items access
25
type Query {
posts:[Post!]!
@aws_auth(cognito_groups: ["Bloggers", "Readers"])
}
type Mutation {
addPost(id:ID!, title:String!):Post!
@aws_auth(cognito_groups: ["Bloggers"])
}
Access per resource
IAM
26
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"appsync:GraphQL"
],
"Resource": [
"arn:aws:appsync:us-west-2:123456789012:apis/YourGraphQLApiId/types/Query/fields/<Field-1>",
"arn:aws:appsync:us-west-2:123456789012:apis/YourGraphQLApiId/types/Query/fields/<Field-2>",
"arn:aws:appsync:us-west-2:123456789012:apis/YourGraphQLApiId/types/Mutation/fields/<Field-1>",
"arn:aws:appsync:us-west-
2:123456789012:apis/YourGraphQLApiId/types/Subscription/fields/<Field-1>"
]
}
]
}
Access per resource
Monitoring and Logging5
27
We have 3 metrics:
◦ 4xx
◦ 5xx
◦ Latency - processing in ms
Monitoring
28
◦ Request level
▫ Request and response HTTP headers
▫ GraphQL query
▫ Execution summary
▫ GraphQL subscriptions
◦ Field level
▫ Generated Request Mapping with source
and arguments for each field
▫ The transformed Response Mapping for
each field, which includes the data as a
result of resolving that field
▫ Tracing information for each field
Logging
29
There are 3 logging levels available:
◦ NONE - No field-level logs are captured
◦ ERROR - Logs fields that are in error
◦ ALL - The following information is logged for all
fields in the query:
▫ Field-level tracing information
▫ Request/response functions that got
resolved for each field
Logging levels
30
Pricing6
31
CRUD
◦ 250k FREE
◦ $4 per million Query and Data Modification
Operations
+
Data transfer fee charged at EC2 data
transfer rates
COSTS BY AWS DOCS
32
Real-time updates
◦ 250k FREE
◦ 600k connection minutes FREE
◦ $2 per million Real-time updates
Which are priced per 5kb payload of data
delivered. For example, an 8-KB payload is
metered as two real-time updates.
◦ $0.08 per million minutes of connection to
the AWS AppSync service
COSTS BY AWS DOCS
33
◦ 2500 monthly active real-time app users
▫ 25 hours monthly / user
▫ 1000 sent & received events monthly / user
◦ Total cost
▫ Requests - sent messages:
2500 x 1000 x 4$/1M = 10$
▫ Connectivity:
2500 x 1500 x 0.08$ = 0.3$
▫ Data transfer:
1KB x 2.5M = 2.5 MKB = 2.4GB x 0.09$ = 0.21$
▫ Real-time updates:
2500 x 1000 x 2$/1M = 5$
▫ Total:
15.51$
Pricing example
34
Demo7
35
Our case
Routes on Elasticsearch -> Take a look
Price service on API Gateway -> Take a look
Airports on DynamoDB -> Take a look
36
Thumbnail URL generator -> Take a look
Demo - subscriptions8
37
Final thoughts9
38
Pros:
◦ Subscriptions
◦ Fast prototyping
◦ Nice tool for quickly mocking GraphQL at scale
◦ Serverless
Cons:
◦ VTL example from doc
◦ Testing
◦ Any middleware
Logging levels
39
How to prototype really fast?10
40
docs
CREDITS
Special thanks to all the people who made and
released these awesome resources for free:
◦ Presentation template by SlidesCarnival
◦ Photographs by Unsplash
41
Thanks!
ANY QUESTIONS?
42

More Related Content

PDF
I/O intensiveなKafka ConsumerアプリケーションのスループットをLINE Ads Platformではどのように改善したか
PDF
Observability for developer ( Inny So & Andrew Jones, ThoughtWorks) Kafka Su...
PPTX
Shift Remote: WEB - GraphQL and React – Quick Start - Dubravko Bogovic (Infobip)
PPTX
Building a fully Kafka-based product as a Data Scientist | Patrick Neff, BAADER
PDF
Crossing the streams viktor gamov
PPTX
Going Serverless with AWS Lambda at ReportGarden
PPTX
The API Journey: from REST to GraphQL
PPTX
The API Journey: GraphQL Specification and Implementation
I/O intensiveなKafka ConsumerアプリケーションのスループットをLINE Ads Platformではどのように改善したか
Observability for developer ( Inny So & Andrew Jones, ThoughtWorks) Kafka Su...
Shift Remote: WEB - GraphQL and React – Quick Start - Dubravko Bogovic (Infobip)
Building a fully Kafka-based product as a Data Scientist | Patrick Neff, BAADER
Crossing the streams viktor gamov
Going Serverless with AWS Lambda at ReportGarden
The API Journey: from REST to GraphQL
The API Journey: GraphQL Specification and Implementation

What's hot (20)

PDF
Migrating from Monolithic to Serverless (Kostas Katsikas) - GreeceJS #22
PPTX
Cloud Abstraction Libraries: Implementation and Comparison
PDF
Live Event Debugging With ksqlDB at Reddit | Hannah Hagen and Paul Kiernan, R...
PDF
The Magic of LINE 購物 Testing
PPTX
An experiment with AWS Lambda
PDF
Flink Forward Berlin 2018: Ravi Suhag & Sumanth Nakshatrithaya - "Managing Fl...
PDF
Elasticsearch @ Keboola
PDF
Lambda architecture
PDF
Flink Forward Berlin 2018: Brian Wolfe - "Upshot: distributed tracing using F...
PDF
Flink Forward Berlin 2017: Mihail Vieru - A Materialization Engine for Data I...
PDF
Flink Forward Berlin 2017: Gyula Fora - Building and operating large-scale st...
PDF
KliqMap 1.0 english v4
PPTX
GraphQL, Redux, and React
PDF
Uber Business Metrics Generation and Management Through Apache Flink
PDF
Running Flink in Production: The good, The bad and The in Between - Lakshmi ...
PDF
All Streams Ahead! ksqlDB Workshop ANZ
PDF
ksqlDB Workshop
PDF
Productionize spark structured streaming
PDF
Server-less solution for moving Millions of Images in Cloud - Brett Sutter, ...
PPTX
KliqPlan Overview
Migrating from Monolithic to Serverless (Kostas Katsikas) - GreeceJS #22
Cloud Abstraction Libraries: Implementation and Comparison
Live Event Debugging With ksqlDB at Reddit | Hannah Hagen and Paul Kiernan, R...
The Magic of LINE 購物 Testing
An experiment with AWS Lambda
Flink Forward Berlin 2018: Ravi Suhag & Sumanth Nakshatrithaya - "Managing Fl...
Elasticsearch @ Keboola
Lambda architecture
Flink Forward Berlin 2018: Brian Wolfe - "Upshot: distributed tracing using F...
Flink Forward Berlin 2017: Mihail Vieru - A Materialization Engine for Data I...
Flink Forward Berlin 2017: Gyula Fora - Building and operating large-scale st...
KliqMap 1.0 english v4
GraphQL, Redux, and React
Uber Business Metrics Generation and Management Through Apache Flink
Running Flink in Production: The good, The bad and The in Between - Lakshmi ...
All Streams Ahead! ksqlDB Workshop ANZ
ksqlDB Workshop
Productionize spark structured streaming
Server-less solution for moving Millions of Images in Cloud - Brett Sutter, ...
KliqPlan Overview
Ad

Similar to Serverless GraphQL. AppSync 101 (20)

PDF
Introduzione a GraphQL
PDF
Rapid mobile development using GraphQL and AWS AppSync
PDF
Marcia Villalba "Developing Serverless Applications with GraphQL"
PDF
API moderne e real-time per applicazioni innovative
PDF
GraphQL backend with AWS AppSync & AWS Lambda
PDF
AppSync in real world - pitfalls, unexpected benefits & lessons learnt
PDF
Danilo Poccia - Real-Time Serverless Backends with GraphQL - Codemotion Berli...
PDF
AWS Stockholm Summit 19- Building serverless applications with GraphQL
PDF
Serverless <3 GraphQL - AWS UG Tampere 2020
PDF
Danilo Poccia - Real-Time Serverless Backends with GraphQL - Codemotion Berli...
PPTX
AWS App Sync (DC Startup Week 2019)
PDF
"Integrate your front end apps with serverless backend in the cloud", Sebasti...
PDF
Simplify your Web & Mobile applications with cloud-based serverless backends
PDF
Why your next serverless project should use AWS AppSync
PDF
Intro to GraphQL
PPTX
A talk on AWS AppSync
PDF
Full Stack Serverless 1st Edition Nader Dabit
PDF
20200513 Getting started with AWS Amplify
PDF
Full Stack Serverless 1st Edition Nader Dabit
PDF
AWS DevDay Berlin 2019 - Simplify your Web & Mobile apps with cloud-based ser...
Introduzione a GraphQL
Rapid mobile development using GraphQL and AWS AppSync
Marcia Villalba "Developing Serverless Applications with GraphQL"
API moderne e real-time per applicazioni innovative
GraphQL backend with AWS AppSync & AWS Lambda
AppSync in real world - pitfalls, unexpected benefits & lessons learnt
Danilo Poccia - Real-Time Serverless Backends with GraphQL - Codemotion Berli...
AWS Stockholm Summit 19- Building serverless applications with GraphQL
Serverless <3 GraphQL - AWS UG Tampere 2020
Danilo Poccia - Real-Time Serverless Backends with GraphQL - Codemotion Berli...
AWS App Sync (DC Startup Week 2019)
"Integrate your front end apps with serverless backend in the cloud", Sebasti...
Simplify your Web & Mobile applications with cloud-based serverless backends
Why your next serverless project should use AWS AppSync
Intro to GraphQL
A talk on AWS AppSync
Full Stack Serverless 1st Edition Nader Dabit
20200513 Getting started with AWS Amplify
Full Stack Serverless 1st Edition Nader Dabit
AWS DevDay Berlin 2019 - Simplify your Web & Mobile apps with cloud-based ser...
Ad

Recently uploaded (20)

PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
August Patch Tuesday
PDF
Unlocking AI with Model Context Protocol (MCP)
PPT
Teaching material agriculture food technology
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
Machine learning based COVID-19 study performance prediction
PDF
Encapsulation theory and applications.pdf
PDF
Video forgery: An extensive analysis of inter-and intra-frame manipulation al...
PPTX
Spectroscopy.pptx food analysis technology
PDF
Assigned Numbers - 2025 - Bluetooth® Document
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PPTX
Machine Learning_overview_presentation.pptx
PDF
Approach and Philosophy of On baking technology
PDF
gpt5_lecture_notes_comprehensive_20250812015547.pdf
PDF
Encapsulation_ Review paper, used for researhc scholars
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
Getting Started with Data Integration: FME Form 101
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PPTX
1. Introduction to Computer Programming.pptx
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
August Patch Tuesday
Unlocking AI with Model Context Protocol (MCP)
Teaching material agriculture food technology
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Mobile App Security Testing_ A Comprehensive Guide.pdf
Machine learning based COVID-19 study performance prediction
Encapsulation theory and applications.pdf
Video forgery: An extensive analysis of inter-and intra-frame manipulation al...
Spectroscopy.pptx food analysis technology
Assigned Numbers - 2025 - Bluetooth® Document
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
Machine Learning_overview_presentation.pptx
Approach and Philosophy of On baking technology
gpt5_lecture_notes_comprehensive_20250812015547.pdf
Encapsulation_ Review paper, used for researhc scholars
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Getting Started with Data Integration: FME Form 101
MIND Revenue Release Quarter 2 2025 Press Release
1. Introduction to Computer Programming.pptx

Serverless GraphQL. AppSync 101

  • 2. Agenda Plan What is AppSync? What can you use it for? What is it made of? AWS AppSync types Subscriptions Security Monitoring and logging Pricing Demo - existing data sources Final thoughts How to prototype really fast 2
  • 3. What is AppSync? AWS service that enables developers to easily build products based on GraphQL. Out of the box it supports many AWS products including: ● data storages ● lambdas ● cloud security 1 3
  • 4. What can you use it for?2 4
  • 5. What can you use it for? Use cases: ◦ Exposing GraphQL API ◦ Real-time interaction applications ▫ Chats ▫ Collaboration ▫ News feed etc. 5
  • 6. What is made of?3 6
  • 8. Engine for: ◦ Security ◦ Processing requests ◦ Subscriptions ◦ Batch processes Black box for developer. GraphQL Proxy 8
  • 9. GraphQL schema describing API contract Schema 9
  • 10. Types ◦ ID ◦ String ◦ Int ◦ Float ◦ Boolean ◦ AWSDate ◦ AWSTime ◦ AWSDateTime ◦ AWSTimestamp ◦ AWSEmail - Valid RFC 822 ◦ AWSJSON - Valid RFC 8259 ◦ AWSURL - Valid URL ◦ AWSPhone - Valid phone number (no spec in docs) ◦ AWSIPAddress - Valid IPv4 or IPv6 10
  • 11. Types AppSync supports interfaces and unions. The caveat here is that you have to do is to append ‘__typename’ for type resolution #foreach ($result in $context.result) ## Extract type name from the id field. #set( $typeName = $result.id.split("-")[0] ) #set( $ignore = $result.put("__typename", $typeName)) #end $util.toJson($context.result) 11
  • 12. Data Sources DynamoDB AWS NoSQL Elasticsearch Search engine Lambda AWS Lambda function RDS Aurora - Relational Database from AWS HTTP Any root http endpoint None Internal logic 12
  • 13. Usually in GraphQL: Responsible for serving requested data by field. In AppSync: Transforming request to data source request and mapping data source response. Resolvers 13
  • 14. Unit resolver performs single operation on data source. It can also be a batch operation. But not for all data sources. Supports DynamoDB and Lambda. Unit resolver 14
  • 15. Allows executing multiple operations against one or more data sources. Composed of a list of functions. Each function is executed in sequence and can execute a single operation on a data source. Pipeline resolver 15
  • 16. Example use cases ◦ Load and transform fields based on the requested format ◦ Custom roles setup application Pipeline resolver 16
  • 17. ◦ $ctx.stash ◦ $ctx.prev.result ◦ #return(data: Object) - breaks mapping template with data ◦ $util.error - breaks execution with error ◦ $util.appendError - marks error without interruption Pipeline utilities 17
  • 18. Functions are single operations for redundant logic on the GraphQL Proxy as a part of pipeline resolvers. It can be our customer role check from previous section Functions 18
  • 19. #set($validMinPrice = $util.matches("d{1,3}[,.]?(d{1,2})?",$ctx.args.minPrice)) #if (!$validMinPrice) $util.error("Provided price input is not valid.") #end { "version": "2018-05-29", "statements": [ "select * from Pets where price > :MIN" ], "variableMap": { ":MIN": $ctx.args.minPrice } } Functions 19
  • 20. Testing and debugging resolvers 20
  • 21. Subscription at scale for datasources not supporting this feature. AWS takes heavy-lifting and after successful mutation it pushes notification to all subscribers for you. Subscriptions 21
  • 23. Security Cognito/OpenID AWS auth service supporting standards like ◦ OAuth 2.0 ◦ SAML 2.0 ◦ OpenID Connect OpenID Docs IAM For other AWS services and users, permissions per resource / field API KEY Constant key sent over x-api-key header 23
  • 25. Cognito items access 25 type Query { posts:[Post!]! @aws_auth(cognito_groups: ["Bloggers", "Readers"]) } type Mutation { addPost(id:ID!, title:String!):Post! @aws_auth(cognito_groups: ["Bloggers"]) } Access per resource
  • 26. IAM 26 { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "appsync:GraphQL" ], "Resource": [ "arn:aws:appsync:us-west-2:123456789012:apis/YourGraphQLApiId/types/Query/fields/<Field-1>", "arn:aws:appsync:us-west-2:123456789012:apis/YourGraphQLApiId/types/Query/fields/<Field-2>", "arn:aws:appsync:us-west-2:123456789012:apis/YourGraphQLApiId/types/Mutation/fields/<Field-1>", "arn:aws:appsync:us-west- 2:123456789012:apis/YourGraphQLApiId/types/Subscription/fields/<Field-1>" ] } ] } Access per resource
  • 28. We have 3 metrics: ◦ 4xx ◦ 5xx ◦ Latency - processing in ms Monitoring 28
  • 29. ◦ Request level ▫ Request and response HTTP headers ▫ GraphQL query ▫ Execution summary ▫ GraphQL subscriptions ◦ Field level ▫ Generated Request Mapping with source and arguments for each field ▫ The transformed Response Mapping for each field, which includes the data as a result of resolving that field ▫ Tracing information for each field Logging 29
  • 30. There are 3 logging levels available: ◦ NONE - No field-level logs are captured ◦ ERROR - Logs fields that are in error ◦ ALL - The following information is logged for all fields in the query: ▫ Field-level tracing information ▫ Request/response functions that got resolved for each field Logging levels 30
  • 32. CRUD ◦ 250k FREE ◦ $4 per million Query and Data Modification Operations + Data transfer fee charged at EC2 data transfer rates COSTS BY AWS DOCS 32
  • 33. Real-time updates ◦ 250k FREE ◦ 600k connection minutes FREE ◦ $2 per million Real-time updates Which are priced per 5kb payload of data delivered. For example, an 8-KB payload is metered as two real-time updates. ◦ $0.08 per million minutes of connection to the AWS AppSync service COSTS BY AWS DOCS 33
  • 34. ◦ 2500 monthly active real-time app users ▫ 25 hours monthly / user ▫ 1000 sent & received events monthly / user ◦ Total cost ▫ Requests - sent messages: 2500 x 1000 x 4$/1M = 10$ ▫ Connectivity: 2500 x 1500 x 0.08$ = 0.3$ ▫ Data transfer: 1KB x 2.5M = 2.5 MKB = 2.4GB x 0.09$ = 0.21$ ▫ Real-time updates: 2500 x 1000 x 2$/1M = 5$ ▫ Total: 15.51$ Pricing example 34
  • 36. Our case Routes on Elasticsearch -> Take a look Price service on API Gateway -> Take a look Airports on DynamoDB -> Take a look 36 Thumbnail URL generator -> Take a look
  • 39. Pros: ◦ Subscriptions ◦ Fast prototyping ◦ Nice tool for quickly mocking GraphQL at scale ◦ Serverless Cons: ◦ VTL example from doc ◦ Testing ◦ Any middleware Logging levels 39
  • 40. How to prototype really fast?10 40 docs
  • 41. CREDITS Special thanks to all the people who made and released these awesome resources for free: ◦ Presentation template by SlidesCarnival ◦ Photographs by Unsplash 41