Deploying GraphQL in
a Serverless Context
Kevin Old - @kevinold
Slide 2
Slide 2 text
No content
Slide 3
Slide 3 text
What is a Serverless architecture?
How GraphQL fits into a Serverless architecture
How to get started with Serverless + GraphQL
Immediate use cases
Pros and Cons
Agenda
Slide 4
Slide 4 text
Serverless?
it’s ok to roll your eyes, no really, it is :)
Slide 5
Slide 5 text
Function as a Service
(FaaS)
Slide 6
Slide 6 text
No content
Slide 7
Slide 7 text
No content
Slide 8
Slide 8 text
Write single-purpose stateless functions
Design push-based, event-driven pipelines
Create thicker, more powerful front ends
Embrace third party services
Use a compute service to execute code on demand
Principles of a Serverless
Architecture
Slide 9
Slide 9 text
❤
Slide 10
Slide 10 text
Lambda is really cool, but is a massive pain to setup
Slide 11
Slide 11 text
No content
Slide 12
Slide 12 text
No content
Slide 13
Slide 13 text
No content
Slide 14
Slide 14 text
No content
Slide 15
Slide 15 text
Click "Create a Lambda function"
Choose a Blueprint function
Configure how it is triggered (API Gateway, DynamoDB, CloudWatch, etc.)
Configure the function
Runtime (Node.js 4.3)
Memory
Timeout
Lambda function code (in WYSIWYG editor)
Handler path inside container
Role creation
Policy creation
VPC access
Slide 16
Slide 16 text
No content
Slide 17
Slide 17 text
"Optimize human time, not
machine time"
via https://medium.com/apollo-stack/how-to-build-graphql-servers-87587591ded5
101
Function
Event
Resource (S3, Dynamo, IAM, etc)
Service
Slide 22
Slide 22 text
No content
Slide 23
Slide 23 text
No content
Slide 24
Slide 24 text
No content
Slide 25
Slide 25 text
No content
Slide 26
Slide 26 text
No content
Slide 27
Slide 27 text
No content
Slide 28
Slide 28 text
No content
Slide 29
Slide 29 text
+
Using GraphQL + Serverless to serve up endless Dad Jokes
Slide 30
Slide 30 text
No content
Slide 31
Slide 31 text
No content
Slide 32
Slide 32 text
No content
Slide 33
Slide 33 text
No content
Slide 34
Slide 34 text
No content
Slide 35
Slide 35 text
No content
Slide 36
Slide 36 text
Pros
No longer managing servers
Not running server(s) 24 / 7
Scale instantly
Serverless, Apex, etc.
AWS, Google, Microsoft, IBM solutions
Pay only for what you use
Slide 37
Slide 37 text
No content
Slide 38
Slide 38 text
Marketing site (S3) + Form
Mobile backends
Background Jobs (Image resize, log processing)
CMS and low-bandwidth BFF's (Backend's for Frontend’s)
Any pre-compute stored (S3) for later retrieval
Startups / Prototyping products
Test, Dev and Staging environments
Immediate Use Cases
Slide 39
Slide 39 text
Server-rendered React
Security/Compliant heavy apps
Read-only API’s
Anything with an SLA
High throughput / availability
Possible, but not a good fit?
Slide 40
Slide 40 text
Cons
Limited documentation/examples
Latency
Best practices are still being defined
Security
Offline development
Serverless (v0.x stable, v1 beta), Apex, etc.