We’re only on day two of re:Invent 2017, and Amazon has already made another huge announcement: AWS AppSync.
Mobile app development has come a long way since the advent of the smartphone. Real-time data syncing is hugely important to the social component common to most mobile apps, and that’s being achieved through the cloud. But if you’ve ever struggled with a complex SQL query, you’ll have an idea of why this sometimes presents a challenge (not that this problem is specific to relational databases, of course). GraphQL intends to solve this problem, and AWS AppSync intends to make GraphQL development easier than ever.
What is GraphQL?
GraphQL is a real-time data query language developed by Facebook that offers a ton of benefits. If you’re not familiar with GraphQL, the first thing you’ll probably notice is that the queries actually resemble the structure of your data. This is by design – GraphQL is responsive, which is why it’s an excellent choice for real-time data retrieval.
In a nutshell, here’s how it works:
- You define a schema for your data so GraphQL knows exactly what it’s looking for, and in what format
- You make a query consisting only of the data you want from your data source
- You get your response in a predictable format, thanks to the schema you defined earlier
The result is a super fast query language that’s great for not just mobile apps, but any sort of development where speed is a key factor.
What is AWS AppSync?
AWS AppSync allows you to create an API that you can use GraphQL to query. It’s a managed, serverless service, which comes with a number of benefits like scalability and fault tolerance.
To map the above descriptions to this new service:
- You define a data schema in AppSync, and the service creates the necessary data source (a DynamoDB table, for instance)
AppSync also appears to support interactive queries in the browser, which is another great feature for those who might be more accustomed to reading and writing to DynamoDB and other data sources “the old-fashioned way.”
Arguably the biggest feature, however, is offline querying, which is especially important for mobile apps. By creating a local cache, queries can be run on “your version” of the data until the device is back online, at which point the device syncs back up with the server, or whatever your data source may be..
GraphQL offers a ton of benefits in terms of speed and predictability for experienced developers working on large apps. It also has a very friendly user interface for those who are still learning. With AppSync, Amazon is tapping into yet another cutting edge technology and making development much easier. In terms of who’s already using GraphQL, this new offering shouldn’t be a surprise. Companies like GitHub, Pinterest, and Intuit are already using it in production, and many popular open source projects like GatsbyJS have adopted it as well.
Yesterday, Amazon announced their new augmented/virtual reality service. Today, it’s GraphQL. I’m starting to notice a theme here – a lot of times we think about AWS as infrastructure and operations, but this year’s re:Invent announcements have been very developer-focused so far. We’ve already made a few predictions about what will come out of this year’s event, but so far, I’m very pleasantly surprised.
Want to see more? Check out the AWS blog for an in-depth look at how AppSync works in practice.