Deploying GraphQL in a Serverless Context€¦ · How GraphQL fits into a Serverless architecture...
Transcript of Deploying GraphQL in a Serverless Context€¦ · How GraphQL fits into a Serverless architecture...
![Page 1: Deploying GraphQL in a Serverless Context€¦ · How GraphQL fits into a Serverless architecture How to get started with Serverless + GraphQL Immediate use cases Pros and Cons Agenda.](https://reader035.fdocuments.us/reader035/viewer/2022071109/5fe4c438b7a3f2025856915a/html5/thumbnails/1.jpg)
Deploying GraphQL in a Serverless Context
Kevin Old - @kevinold
![Page 2: Deploying GraphQL in a Serverless Context€¦ · How GraphQL fits into a Serverless architecture How to get started with Serverless + GraphQL Immediate use cases Pros and Cons Agenda.](https://reader035.fdocuments.us/reader035/viewer/2022071109/5fe4c438b7a3f2025856915a/html5/thumbnails/2.jpg)
![Page 3: Deploying GraphQL in a Serverless Context€¦ · How GraphQL fits into a Serverless architecture How to get started with Serverless + GraphQL Immediate use cases Pros and Cons Agenda.](https://reader035.fdocuments.us/reader035/viewer/2022071109/5fe4c438b7a3f2025856915a/html5/thumbnails/3.jpg)
What is a Serverless architecture?
How GraphQL fits into a Serverless architectureHow to get started with Serverless + GraphQL
Immediate use casesPros and Cons
Agenda
![Page 4: Deploying GraphQL in a Serverless Context€¦ · How GraphQL fits into a Serverless architecture How to get started with Serverless + GraphQL Immediate use cases Pros and Cons Agenda.](https://reader035.fdocuments.us/reader035/viewer/2022071109/5fe4c438b7a3f2025856915a/html5/thumbnails/4.jpg)
Serverless?
it’s ok to roll your eyes, no really, it is :)
![Page 5: Deploying GraphQL in a Serverless Context€¦ · How GraphQL fits into a Serverless architecture How to get started with Serverless + GraphQL Immediate use cases Pros and Cons Agenda.](https://reader035.fdocuments.us/reader035/viewer/2022071109/5fe4c438b7a3f2025856915a/html5/thumbnails/5.jpg)
Function as a Service(FaaS)
![Page 6: Deploying GraphQL in a Serverless Context€¦ · How GraphQL fits into a Serverless architecture How to get started with Serverless + GraphQL Immediate use cases Pros and Cons Agenda.](https://reader035.fdocuments.us/reader035/viewer/2022071109/5fe4c438b7a3f2025856915a/html5/thumbnails/6.jpg)
![Page 7: Deploying GraphQL in a Serverless Context€¦ · How GraphQL fits into a Serverless architecture How to get started with Serverless + GraphQL Immediate use cases Pros and Cons Agenda.](https://reader035.fdocuments.us/reader035/viewer/2022071109/5fe4c438b7a3f2025856915a/html5/thumbnails/7.jpg)
![Page 8: Deploying GraphQL in a Serverless Context€¦ · How GraphQL fits into a Serverless architecture How to get started with Serverless + GraphQL Immediate use cases Pros and Cons Agenda.](https://reader035.fdocuments.us/reader035/viewer/2022071109/5fe4c438b7a3f2025856915a/html5/thumbnails/8.jpg)
Write single-purpose stateless functions
Design push-based, event-driven pipelinesCreate thicker, more powerful front ends
Embrace third party servicesUse a compute service to execute code on demand
Principles of a Serverless Architecture
![Page 9: Deploying GraphQL in a Serverless Context€¦ · How GraphQL fits into a Serverless architecture How to get started with Serverless + GraphQL Immediate use cases Pros and Cons Agenda.](https://reader035.fdocuments.us/reader035/viewer/2022071109/5fe4c438b7a3f2025856915a/html5/thumbnails/9.jpg)
👁 ❤
![Page 10: Deploying GraphQL in a Serverless Context€¦ · How GraphQL fits into a Serverless architecture How to get started with Serverless + GraphQL Immediate use cases Pros and Cons Agenda.](https://reader035.fdocuments.us/reader035/viewer/2022071109/5fe4c438b7a3f2025856915a/html5/thumbnails/10.jpg)
Lambda is really cool, but is a massive pain to setup
![Page 11: Deploying GraphQL in a Serverless Context€¦ · How GraphQL fits into a Serverless architecture How to get started with Serverless + GraphQL Immediate use cases Pros and Cons Agenda.](https://reader035.fdocuments.us/reader035/viewer/2022071109/5fe4c438b7a3f2025856915a/html5/thumbnails/11.jpg)
![Page 12: Deploying GraphQL in a Serverless Context€¦ · How GraphQL fits into a Serverless architecture How to get started with Serverless + GraphQL Immediate use cases Pros and Cons Agenda.](https://reader035.fdocuments.us/reader035/viewer/2022071109/5fe4c438b7a3f2025856915a/html5/thumbnails/12.jpg)
![Page 13: Deploying GraphQL in a Serverless Context€¦ · How GraphQL fits into a Serverless architecture How to get started with Serverless + GraphQL Immediate use cases Pros and Cons Agenda.](https://reader035.fdocuments.us/reader035/viewer/2022071109/5fe4c438b7a3f2025856915a/html5/thumbnails/13.jpg)
![Page 14: Deploying GraphQL in a Serverless Context€¦ · How GraphQL fits into a Serverless architecture How to get started with Serverless + GraphQL Immediate use cases Pros and Cons Agenda.](https://reader035.fdocuments.us/reader035/viewer/2022071109/5fe4c438b7a3f2025856915a/html5/thumbnails/14.jpg)
![Page 15: Deploying GraphQL in a Serverless Context€¦ · How GraphQL fits into a Serverless architecture How to get started with Serverless + GraphQL Immediate use cases Pros and Cons Agenda.](https://reader035.fdocuments.us/reader035/viewer/2022071109/5fe4c438b7a3f2025856915a/html5/thumbnails/15.jpg)
Click "Create a Lambda function"Choose a Blueprint functionConfigure how it is triggered (API Gateway, DynamoDB, CloudWatch, etc.)Configure the function
Runtime (Node.js 4.3)MemoryTimeoutLambda function code (in WYSIWYG editor)Handler path inside containerRole creationPolicy creationVPC access
![Page 16: Deploying GraphQL in a Serverless Context€¦ · How GraphQL fits into a Serverless architecture How to get started with Serverless + GraphQL Immediate use cases Pros and Cons Agenda.](https://reader035.fdocuments.us/reader035/viewer/2022071109/5fe4c438b7a3f2025856915a/html5/thumbnails/16.jpg)
![Page 17: Deploying GraphQL in a Serverless Context€¦ · How GraphQL fits into a Serverless architecture How to get started with Serverless + GraphQL Immediate use cases Pros and Cons Agenda.](https://reader035.fdocuments.us/reader035/viewer/2022071109/5fe4c438b7a3f2025856915a/html5/thumbnails/17.jpg)
"Optimize human time, not machine time"
via https://medium.com/apollo-stack/how-to-build-graphql-servers-87587591ded5
![Page 18: Deploying GraphQL in a Serverless Context€¦ · How GraphQL fits into a Serverless architecture How to get started with Serverless + GraphQL Immediate use cases Pros and Cons Agenda.](https://reader035.fdocuments.us/reader035/viewer/2022071109/5fe4c438b7a3f2025856915a/html5/thumbnails/18.jpg)
Automation for working with AWS Lambda, etc.
![Page 19: Deploying GraphQL in a Serverless Context€¦ · How GraphQL fits into a Serverless architecture How to get started with Serverless + GraphQL Immediate use cases Pros and Cons Agenda.](https://reader035.fdocuments.us/reader035/viewer/2022071109/5fe4c438b7a3f2025856915a/html5/thumbnails/19.jpg)
+ 😎=
![Page 20: Deploying GraphQL in a Serverless Context€¦ · How GraphQL fits into a Serverless architecture How to get started with Serverless + GraphQL Immediate use cases Pros and Cons Agenda.](https://reader035.fdocuments.us/reader035/viewer/2022071109/5fe4c438b7a3f2025856915a/html5/thumbnails/20.jpg)
101$ npm install -g serverless@beta
$ serverless create -t aws-nodejs
$ serverless deploy
$ serverless remove
![Page 21: Deploying GraphQL in a Serverless Context€¦ · How GraphQL fits into a Serverless architecture How to get started with Serverless + GraphQL Immediate use cases Pros and Cons Agenda.](https://reader035.fdocuments.us/reader035/viewer/2022071109/5fe4c438b7a3f2025856915a/html5/thumbnails/21.jpg)
101Function
Event
Resource (S3, Dynamo, IAM, etc)
Service
![Page 22: Deploying GraphQL in a Serverless Context€¦ · How GraphQL fits into a Serverless architecture How to get started with Serverless + GraphQL Immediate use cases Pros and Cons Agenda.](https://reader035.fdocuments.us/reader035/viewer/2022071109/5fe4c438b7a3f2025856915a/html5/thumbnails/22.jpg)
![Page 23: Deploying GraphQL in a Serverless Context€¦ · How GraphQL fits into a Serverless architecture How to get started with Serverless + GraphQL Immediate use cases Pros and Cons Agenda.](https://reader035.fdocuments.us/reader035/viewer/2022071109/5fe4c438b7a3f2025856915a/html5/thumbnails/23.jpg)
![Page 24: Deploying GraphQL in a Serverless Context€¦ · How GraphQL fits into a Serverless architecture How to get started with Serverless + GraphQL Immediate use cases Pros and Cons Agenda.](https://reader035.fdocuments.us/reader035/viewer/2022071109/5fe4c438b7a3f2025856915a/html5/thumbnails/24.jpg)
![Page 25: Deploying GraphQL in a Serverless Context€¦ · How GraphQL fits into a Serverless architecture How to get started with Serverless + GraphQL Immediate use cases Pros and Cons Agenda.](https://reader035.fdocuments.us/reader035/viewer/2022071109/5fe4c438b7a3f2025856915a/html5/thumbnails/25.jpg)
![Page 26: Deploying GraphQL in a Serverless Context€¦ · How GraphQL fits into a Serverless architecture How to get started with Serverless + GraphQL Immediate use cases Pros and Cons Agenda.](https://reader035.fdocuments.us/reader035/viewer/2022071109/5fe4c438b7a3f2025856915a/html5/thumbnails/26.jpg)
![Page 27: Deploying GraphQL in a Serverless Context€¦ · How GraphQL fits into a Serverless architecture How to get started with Serverless + GraphQL Immediate use cases Pros and Cons Agenda.](https://reader035.fdocuments.us/reader035/viewer/2022071109/5fe4c438b7a3f2025856915a/html5/thumbnails/27.jpg)
![Page 28: Deploying GraphQL in a Serverless Context€¦ · How GraphQL fits into a Serverless architecture How to get started with Serverless + GraphQL Immediate use cases Pros and Cons Agenda.](https://reader035.fdocuments.us/reader035/viewer/2022071109/5fe4c438b7a3f2025856915a/html5/thumbnails/28.jpg)
![Page 29: Deploying GraphQL in a Serverless Context€¦ · How GraphQL fits into a Serverless architecture How to get started with Serverless + GraphQL Immediate use cases Pros and Cons Agenda.](https://reader035.fdocuments.us/reader035/viewer/2022071109/5fe4c438b7a3f2025856915a/html5/thumbnails/29.jpg)
+
Using GraphQL + Serverless to serve up endless Dad Jokes
![Page 30: Deploying GraphQL in a Serverless Context€¦ · How GraphQL fits into a Serverless architecture How to get started with Serverless + GraphQL Immediate use cases Pros and Cons Agenda.](https://reader035.fdocuments.us/reader035/viewer/2022071109/5fe4c438b7a3f2025856915a/html5/thumbnails/30.jpg)
![Page 31: Deploying GraphQL in a Serverless Context€¦ · How GraphQL fits into a Serverless architecture How to get started with Serverless + GraphQL Immediate use cases Pros and Cons Agenda.](https://reader035.fdocuments.us/reader035/viewer/2022071109/5fe4c438b7a3f2025856915a/html5/thumbnails/31.jpg)
![Page 32: Deploying GraphQL in a Serverless Context€¦ · How GraphQL fits into a Serverless architecture How to get started with Serverless + GraphQL Immediate use cases Pros and Cons Agenda.](https://reader035.fdocuments.us/reader035/viewer/2022071109/5fe4c438b7a3f2025856915a/html5/thumbnails/32.jpg)
![Page 33: Deploying GraphQL in a Serverless Context€¦ · How GraphQL fits into a Serverless architecture How to get started with Serverless + GraphQL Immediate use cases Pros and Cons Agenda.](https://reader035.fdocuments.us/reader035/viewer/2022071109/5fe4c438b7a3f2025856915a/html5/thumbnails/33.jpg)
![Page 34: Deploying GraphQL in a Serverless Context€¦ · How GraphQL fits into a Serverless architecture How to get started with Serverless + GraphQL Immediate use cases Pros and Cons Agenda.](https://reader035.fdocuments.us/reader035/viewer/2022071109/5fe4c438b7a3f2025856915a/html5/thumbnails/34.jpg)
![Page 35: Deploying GraphQL in a Serverless Context€¦ · How GraphQL fits into a Serverless architecture How to get started with Serverless + GraphQL Immediate use cases Pros and Cons Agenda.](https://reader035.fdocuments.us/reader035/viewer/2022071109/5fe4c438b7a3f2025856915a/html5/thumbnails/35.jpg)
![Page 36: Deploying GraphQL in a Serverless Context€¦ · How GraphQL fits into a Serverless architecture How to get started with Serverless + GraphQL Immediate use cases Pros and Cons Agenda.](https://reader035.fdocuments.us/reader035/viewer/2022071109/5fe4c438b7a3f2025856915a/html5/thumbnails/36.jpg)
Pros
No longer managing servers
Not running server(s) 24 / 7Scale instantly
Serverless, Apex, etc.AWS, Google, Microsoft, IBM solutions
Pay only for what you use
![Page 37: Deploying GraphQL in a Serverless Context€¦ · How GraphQL fits into a Serverless architecture How to get started with Serverless + GraphQL Immediate use cases Pros and Cons Agenda.](https://reader035.fdocuments.us/reader035/viewer/2022071109/5fe4c438b7a3f2025856915a/html5/thumbnails/37.jpg)
![Page 38: Deploying GraphQL in a Serverless Context€¦ · How GraphQL fits into a Serverless architecture How to get started with Serverless + GraphQL Immediate use cases Pros and Cons Agenda.](https://reader035.fdocuments.us/reader035/viewer/2022071109/5fe4c438b7a3f2025856915a/html5/thumbnails/38.jpg)
Marketing site (S3) + FormMobile backendsBackground Jobs (Image resize, log processing)CMS and low-bandwidth BFF's (Backend's for Frontend’s)Any pre-compute stored (S3) for later retrievalStartups / Prototyping productsTest, Dev and Staging environments
Immediate Use Cases
![Page 39: Deploying GraphQL in a Serverless Context€¦ · How GraphQL fits into a Serverless architecture How to get started with Serverless + GraphQL Immediate use cases Pros and Cons Agenda.](https://reader035.fdocuments.us/reader035/viewer/2022071109/5fe4c438b7a3f2025856915a/html5/thumbnails/39.jpg)
Server-rendered ReactSecurity/Compliant heavy appsRead-only API’sAnything with an SLAHigh throughput / availability
Possible, but not a good fit?
![Page 40: Deploying GraphQL in a Serverless Context€¦ · How GraphQL fits into a Serverless architecture How to get started with Serverless + GraphQL Immediate use cases Pros and Cons Agenda.](https://reader035.fdocuments.us/reader035/viewer/2022071109/5fe4c438b7a3f2025856915a/html5/thumbnails/40.jpg)
ConsLimited documentation/examples
Latency
Best practices are still being defined
Security
Offline development
Serverless (v0.x stable, v1 beta), Apex, etc.
![Page 41: Deploying GraphQL in a Serverless Context€¦ · How GraphQL fits into a Serverless architecture How to get started with Serverless + GraphQL Immediate use cases Pros and Cons Agenda.](https://reader035.fdocuments.us/reader035/viewer/2022071109/5fe4c438b7a3f2025856915a/html5/thumbnails/41.jpg)
Debugging whoas
![Page 42: Deploying GraphQL in a Serverless Context€¦ · How GraphQL fits into a Serverless architecture How to get started with Serverless + GraphQL Immediate use cases Pros and Cons Agenda.](https://reader035.fdocuments.us/reader035/viewer/2022071109/5fe4c438b7a3f2025856915a/html5/thumbnails/42.jpg)
Cons