Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

GraphQL and AWS AppSync (Serverless GraphQL service)


Published on

GraphQL has become the API of choice for many leading technology companies. In 2018 AWS made its’ managed GraphQL service, AWS AppSync, generally available. In this talk we discussed:

* What GraphQL is
* Why it is being adopted
* What AWS AppSync is and how it works
* Where AWS AppSync fits into the broader AWS serverless landscape.

Presenter Bio: Peter Dyer is a Freelancer and contributor. You can follow him on Twitter @peter_dyer.

More info about the event:

Join community to learn how to leverage Serverless Architectures in order to innovate faster, and make your apps scalable & cost-effective!

Published in: Software
  • Login to see the comments

GraphQL and AWS AppSync (Serverless GraphQL service)

  1. 1. Join Home of “Less IT Mess”
  2. 2. Manning Publications 2019 giveaways: 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 2
  3. 3. Tuesday, Jan 29, 2019 1. Introduction 2. Community Open Mic 3. Presentation: Peter Dyer GraphQL, AWS AppSync and AWS Serverless 4. Networking 3 Serverless Toronto Meetup Agenda
  4. 4. Community Open Mic 4 10 seconds of freedom to pitch yourself, or your company
  5. 5. GraphQL, AWS AppSync and AWS Serverless
  6. 6. Who am I Peter Twenty years working in software ● Majority for small software companies ● Majority as a technical product manager Currently focused on fullstack development (opinionated about the stack)
  7. 7. Backend-as-a-Service / Serverless I want interactive software in the hands of users ASAP I want to take advantage of the code that others have written (services or libraries) Humans are almost always the most expensive part of development (At scale, things are different)
  8. 8. My view of Serverless Authentication Database Storage Hosting Functions APIs Analytics Machine Learning Notifications PubSub Etc
  9. 9. Intro to GraphQL
  10. 10. What is GraphQL? “A query language for your API” Originated in Facebook (2012) Open-source specification (2015) “Competitor” to REST Source:
  11. 11. Why GraphQL? Ask for what you want, and get only that Get many resources in a single request Discoverability (documentation) is built in Avoid API versioning It’s just the API
  12. 12. Who is using GraphQL ● Netflix ● New York Times ● AirBnB ● Telus ● Etc Source:
  13. 13. vs REST In common ● HTTP ● JSON ● Just API ● Good tooling GraphQL Improvements ● No over-fetching ● No under-fetching ● No (limited) need for versioning ● Documentation is built in
  14. 14. Star Wars REST GraphQL
  15. 15. Star Wars - list people (just names) REST people Result: 7,447 characters (for page 1, 10 of 87 people) GraphQL query { allPeople { people { name } } } Result: 4,916 characters
  16. 16. Star Wars - name of Luke’s films REST people/1 films/1/ films/2/ films/3/ films/6/ films/7/ Result: ~2,500 characters per request (6 requests) GraphQL query { person(id: "cGVvcGxlOjE=") { name filmConnection { films { title } } } } Result: 492 characters
  17. 17. Star Wars - add shoe_size field to people REST Every ‘good’ implementation breaks, or new API version Someone needs to update the documentation GraphQL Nothing breaks, anyone who wants to can start using the new field Documentation has been automatically updated
  18. 18. GraphQL terminology ● Type system ● Schema ● Queries ● Mutations ● Subscriptions ● Resolver ● Client & Server
  19. 19. The GraphQL challenge ● Bad queries ○ Depth problems ○ Too much data
  20. 20. AWS AppSync
  21. 21. AWS AppSync Amazon’s GraphQL service “AWS AppSync is a serverless back-end for mobile, web and enterprise applications”
  22. 22. Architecture Source:
  23. 23. How it works Resolvers "translate" GraphQL to do something with a "Data Source" Data Sources = DynamoDB, Lambda, ElasticSearch, Aurora, HTTP Translation via VTL (Apache Velocity Template Language)
  24. 24. AWS AppSync Walk-through
  25. 25. Steps 1. Create Lambda function(s) that will “resolve” API request a. Use Events to pass in arguments 2. Create AppSync API 3. Add Lambda function(s) as Data Sources to AppSync API 4. Create API schema (GraphQL schema) 5. Attach Resolvers and edit mappings 6. Test API 7. Use API
  26. 26. AWS AppSync and the AWS landscape
  27. 27. Where does AppSync fit in AWS Serverless Short answer Nowhere (it is not part of the documented reference architecture) The real answer Wherever you see API Gateway Wherever an application needs to call an AWS back-end for something AppSync is an API Proxy that leverages GraphQL instead of REST
  28. 28. Amazon API Gateway Source:
  29. 29. Examples (from AWS Serverless) Source:
  30. 30. Wrap up
  31. 31. AWS AppSync (hosted GraphQL) Alternatives AWS is the only big 3 cloud vendor with a GraphQL service GraphQL servers are easily deployed to a server or a PaaS Google Firebase - deploy as a Function (performance?) Prisma Cloud For development (these are not managed services) ● ●
  32. 32. AWS Amplify Framework Evolution of AWS Mobile Hub Amazon's answer to Google Firebase Goal - make it easy for application (front-end) developers to use (consume) back- end resources “The foundation for your cloud-powered mobile & web apps”
  33. 33. Resources (for developers)
  34. 34. Thank you! @peter_dyer