deploying graphql in a serverless context€¦ · how graphql fits into a serverless architecture...

43
Deploying GraphQL in a Serverless Context Kevin Old - @kevinold

Upload: others

Post on 03-Sep-2020

6 views

Category:

Documents


0 download

TRANSCRIPT

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

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
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

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

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

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
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
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

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

👁 ❤

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

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
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
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
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
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

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
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

"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

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

+ 😎=

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

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

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
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
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
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
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
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
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
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

+

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
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
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
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
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
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
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

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
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

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

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

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

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

Cons

Page 43: 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

Thanks!

https://github.com/kevinold/serverless-graphql-dadjokes

@kevinold [email protected]