Diagram 8 of 12

Real time with AppSync and DynamoDB Streams

Data changes reach every connected user without the client polling again. AppSync receives the mutations, DynamoDB Streams detects the changes, and Lambda sends them back to AppSync, which pushes them over WebSocket to subscribed clients.

AWS AppSyncAmazon DynamoDBDynamoDB StreamsAWS Lambda

Diagram

Diagram 8: real time (AppSync + DynamoDB Streams + Lambda)AWS CloudUsersGQLAWS AppSync(GraphQL)DDBAmazon DynamoDB(table)λAWS Lambda(processes)123DynamoDB Streams451. The user sends a GraphQL mutation to AppSync.2. AppSync writes the change to the Amazon DynamoDB table.3. DynamoDB Streams emits the change and a Lambda function receives it.4. Lambda sends the event back to AppSync.5. AppSync pushes the event to subscribed clients over WebSocket.

Comments

Information flow

  1. AWS AppSync

    The user sends a GraphQL mutation to AppSync.

  2. Amazon DynamoDB

    AppSync writes the change to the DynamoDB table.

  3. DynamoDB Streams + AWS Lambda

    DynamoDB Streams emits the change and a Lambda function receives it.

  4. AWS Lambda

    Lambda sends the event back to AppSync.

  5. AWS AppSync

    AppSync pushes the event to subscribed clients over WebSocket.