Building a serverless GraphQL API in the AWS cloud?
GraphQL is an alternative to REST-like APIs and was designed to minimize the number of roundtrips, the main source of perceived latency for web applications. New to GraphQL? Check The path to GraphQL chapter for the motivation behind it.
AppSync is AWS's managed GraphQL solution. No capacity planning, scales to practically infinity, serverless-friendly, and it offers a managed real-time data interface. Never seen AppSync in action? Check out the Why AppSync? chapter.
Learn how to design, implement, and deploy an AppSync API from this book from the first steps to mastery.
Already have a license key? Sign in here
56
Chapters
650+
Pages
25
Code examples
Last updated

About the book

My journey with AppSync and GraphQL started when I joined a project at the end of the prototyping stage and my task was to start a parallel implementation of the backend using these technologies. In the first few days everything was smooth: because of the expressiveness of GraphQL implementing the basics was easy. I didn't need to think about what the clients will need, just expose the data and let them define the queries.

The first major block was implementing real-time data: subscriptions are easy to get started, but when I went on to add basic requirements, things started to get difficult. How can I send two notifications for one change with different data? How can I make sure some users can get some events but not everything?

This was the first major hurdle and I spent several weeks figuring out a solution that checked all the boxes. Then I moved on to implementing access control. It was again a thing that seems easy on tutorials but in practice there are many fine points that are not covered that well.

Overall, I spent about 2 months experimenting and finding ways around the limitations and quirks of AppSync and GraphQL. The idea for a book started from this experience: anybody who uses these technologies will need to go through similar steps, and having a guide with the best practices would be an enormous help. If I had this book when I started with AppSync that would have reduced the time from 2 months to maybe a week. And that's a massive improvement in terms of time needed to get started.

But even after the initial learning period I kept encountering topics that are not trivial to solve. Things like using signed URLs with AppSync for file handling or a custom authorizer for greater control over who can call the API. These are not hard problems but still require familiarity with different corners of AWS.

Then there were the truly hard problems that kept bugging me to figure out. Resilient subscriptions and efficient DynamoDB data modelling are in this category. Some of these problems took weeks to cover in sufficient depth.

This book is the repository of everything I know about AppSync and GraphQL with all the topics covered to help you develop a strong understanding of the technology.

About the author

Tamás Sallai

I'm a software developer focusing mostly on cloud computing and web technologies. I'm especially interested in how to handle edge cases to end up with dependable software.

When I started working with GraphQL I needed to do a lot of research until I felt I have a chance to start building a reliable and robust solution. This book aims to be the guide that covers everything you'll need to get you from working with REST-like APIs to AppSync.

My books and courses:

Author image

Table of contents

  • Introduction Preview
  • GraphQL basics Preview
  • AWS AppSync Preview
    • API configuration Preview
      • Authorization providers
      • Logging and monitoring
      • Custom domains
      • WAF Preview
    • Data sources
      • Lambda
      • DynamoDB
      • HTTP
      • RDS
      • None
    • Resolvers
      • Context
      • Pipeline resolvers
    • Real-time data with subscriptions
      • Event fields
      • Event filtering
      • Notify subscription pattern
      • Access control for subscriptions
    • Implementing access control
      • Schema-based access control
      • Resolver-based access control
      • Hierarchical access control example
    • Handling files
      • Downloads
      • Uploads
  • Infrastructure-as-code
    • Terraform
    • CDK
  • Client-side
    • Sending queries and mutations
    • Implementing subscriptions
      • Simple status updates
      • Values over time
      • Updates to a list over time
  • Example application
    • Schema
    • Database
    • API resources
    • Cognito
    • Resolvers
    • Subscriptions
    • Client-side
  • Glossary
  • About the author
  • Changelog
  • Copyright

Buying options

Building GraphQL APIs with AWS AppSync

Book cover
Includes:
  • Lifetime access to the book
  • All future updates
  • Web, PDF, and Epub versions
Buy for $159.95

Books & Courses package

Need a team license? Send an email to tamas.sallai@advancedweb.hu and we'll figure something out.