Running Serverless Realtime GraphQL Applications With AppSync
Running Serverless Realtime GraphQL Applications With AppSync
About the Book
This is a book for developers, architects and technology leaders who want to learn about the latest generation of cloud technologies and how to build highly scalable, responsive web sites and APIs.
Table of Contents
-
Introduction
-
Here is what we’re going to build
- Quick domain intro
- Upollo architecture:
-
Appsync in five minutes
- What is AppSync?
- When to use AppSync?
- When not to use AppSync?
- Why GraphQL?
- How AppSync works with other AWS services?
-
CDK in five minutes
- Infrastructure as code – literally
- Why CDK?
- CDK constructs
- How CDK compares to other deployment tools
- Setting up CDK for local development
- Setting up your AWS account
- Testing the configuration
-
Part 1: Basic Development tasks
-
Your first AppSync app
- Hello World from CDK and AppSync
- Deploying an AppSync App
- AppSync application structure
- Generating API Keys
- Retrieving CloudFormation outputs with CDK
- Trying it out from the AWS console
- Trying it out from the command line
- Troubleshooting Appsync
- Accessing Data Sources from AppSync
- What are AppSync Resolvers?
- Troubleshooting deployments
- How to remove deployed applications
- Other Authentication options
- Where to find more information?
-
Building a simple GraphQL Schema
- Modelling GraphQl Types
- Modelling GraphqQL operations
- Verifying your schema
- VTL template basics
- Passing arguments using AppSync VTL context
- Formatting results using AppSync VTL utility functions
-
Testing AppSync applications
- Simulating AppSync for local tests
- Automated integration-testing with AppSync
- Securing access using IAM
- Testing API access
- Unit testing VTL templates
-
-
Part 2: Working with persistent data
-
Connecting AppSync to DynamoDB
- Why DynamoDB?
- Adding a database using CDK
- Accessing DynamoDB items using the web console
- Accessing DynamoDB records from the command line
-
Reading from DynamoDB via AppSync:
getSurveyById
- VTL templates for DynamoDB
- Integration testing AppSync with DynamoDb
-
Working with Mutations
- Scope for this chapter
-
Saving to DynamoDB using AppSync:
createSurvey
-
Creating unique IDs in resolvers using
util.autoId
- Updating existing Dynamo records
- Using update conditionals to preventing accidental object creation
-
Single-table dynamo design
- How Dynamo tables compare to SQL tables
- Why single tables?
- Modelling relations with single-table design
- Example Upollo records
-
Migrating resolvers to single-table design: saving answers with
createSurvey
- Using Dynamo batch writes for performance
-
Accessing object graphs with GraphQL
- Using DynamoDB queries to list collections by prefix
- Accessing object graphs using GraphQl subitem queries
-
Adding answers to
getSurveyById
-
Queries for lists:
getAnswersBySurveyId
- Using pipeline resolvers to customise output
-
Sharing VTL templates between resolvers: how to read ID from stash or args with
util.defaultIfNull
- Testing hierarchical resolvers
-
Performing complex updates
- Atomically updating Dynamo item fields
- Using DynamoDB transaction writes for consistency
-
Processing votes:
addVote
-
Capturing timestamps using
$util.time.nowISO8601
-
-
Part 3: Working with web clients
-
Introduction to AWS Amplify
-
Using the
aws-amplify
React Client - Creating and deploying an Amplify App that connects to AppSync
- Running graphQL queries
- Executing GraphQl mutations
-
Using the
-
Authenticating users with AWS Cognito
- What is Cognito?
- User pools
- Hosted UI
- Allowing Cognito access in GraphQL
- Testing Cognito access from the AWS Web console
- Integrating Cognito with Amplify Apps
- Modelling data security using GraphQl
- Restricting data reads using AppSync
- Dealing with unauthorised access on the front end
-
Realtime updates with GraphQl subscriptions
- How GraphQl subscriptions work?
- Declaring Subscriptions in the schema
- Triggering subscriptions with mutations
- Subscribing to updates using Amplify SDK
-
-
Part 4: Connecting to other services using AppSync Resolvers
-
Using AWS Lambda for custom processing
- Converting data using Lambda
- Connecting to other AWS Services (S3)
- Using Lambda logs for CloudWatch metrics
-
Searching using ElasticSearch/OpenSearch
- Updating ElasticSearch documents using DynamoDB streams
- Connecting to external APIs using HTTP resolvers
-
Processing transient data with local resolvers
- Triggering custom notifications
-
-
Part 5: Operating AppSync applications
-
Working with deployment pipelines
- Setting up for teamwork
- Deploying CDK apps using AWS CodePipeline
- Deploying AWS Amplify Apps
- Managing dev, test, staging and production stacks
- Configuring using SSM
-
Monitoring AppSync applications
- ClodudWatch logs
- CloudWatch insights
- Adding custom metrics
- XRay
-
Setting up a custom domain
- Integrating AppSync APIs with CloudFront distributions
- Deploying to multiple regions
-
-
Part 6: Quick reference guide
-
GraphQL reference
- Types
- Mutations
- Queries
- Subscriptions
- AppSync extensions
-
VTL reference
- What is VTL?
- Conditions
- Loops
- AppSync context
- AppSync Utility functions
-
The Leanpub 60 Day 100% Happiness Guarantee
Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.
Now, this is technically risky for us, since you'll have the book or course files either way. But we're so confident in our products and services, and in our authors and readers, that we're happy to offer a full money back guarantee for everything we sell.
You can only find out how good something is by trying it, and because of our 100% money back guarantee there's literally no risk to do so!
So, there's no reason not to click the Add to Cart button, is there?
See full terms...
Earn $8 on a $10 Purchase, and $16 on a $20 Purchase
We pay 80% royalties on purchases of $7.99 or more, and 80% royalties minus a 50 cent flat fee on purchases between $0.99 and $7.98. You earn $8 on a $10 sale, and $16 on a $20 sale. So, if we sell 5000 non-refunded copies of your book for $20, you'll earn $80,000.
(Yes, some authors have already earned much more than that on Leanpub.)
In fact, authors have earnedover $13 millionwriting, publishing and selling on Leanpub.
Learn more about writing on Leanpub
Free Updates. DRM Free.
If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).
Most Leanpub books are available in PDF (for computers) and EPUB (for phones, tablets and Kindle). The formats that a book includes are shown at the top right corner of this page.
Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.
Learn more about Leanpub's ebook formats and where to read them