Running Serverless

Book coming in Q3 2021

New book by AWS Heroes Aleksandar Simovic, Slobodan Stojanovic and Gojko Adzic. Learn how to build and operate responsive, collaborative applications at scale with AWS AppSync and GraphQL.

The book will be available in Q3 2021, subscribe below, and we’ll notify you when the early release is ready.

This book will teach you how to build, test, and operate a GraphQL application using AWS AppSync and AWS Cloud Development Kit (AWS CDK).

Running Serverless: Realtime GraphQL Applications with AppSync

Table of Contents

Part 1: Intro

1 Here is what we’re going to build

Quick domain intro

Upollo architecture

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

3 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 2: Basic Development tasks

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

5 Building a simple GraphQL Schema


Modelling GraphqQL operations

Verifying your schema

VTL template basics

Passing arguments using AppSync VTL context

Formatting results using AppSync VTL utility functions

6 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 3: Working with persistent data

7 Connecting AppSync to DynamoDB

Scope for this chapter

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

8 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

9 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

10 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

11 Performing complex updates

Atomically updating Dynamo item fields

Using DynamoDB transaction writes for consistency

Processing votes: addVote

Capturing timestamps using $util.time.nowISO8601

Part 4: Working with web clients

12 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

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

14 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 5: Connecting to other services using AppSync Resolvers

15 Using AWS Lambda for custom processing

Converting data using Lambda

Connecting to other AWS Services (S3)

Using Lambda logs for CloudWatch metrics

16 Searching using Elastic Search

Updating ElasticSearch documents using DynamoDB streams

17 Connecting to external APIs using HTTP resolvers

18 Processing transient data with local resolvers

Triggering custom notifications

Part 6: Operating AppSync applications

19 Working with deployment pipelines

Setting up for team work

Deploying CDK apps using AWS CodePipeline

Deploying AWS Amplify Apps

Managing dev, test, staging and production stacks

Configuring using SSM

20 Monitoring AppSync applications

ClodudWatch logs

CloudWatch insights

Adding custom metrics

X Ray

21 Setting up a custom domain

Integrating AppSync APIs with CloudFront distributions

Deploying to multiple regions

Part 7: Quick reference guide

22 GraphQL reference





AppSync extensions

23 VTL reference

Whatis VTL?



AppSync context

AppSync Utility functions

Where next?

Subscribe and get notified

The book will be available in Q3 2021, subscribe below, and we’ll notify you when the early release is ready.