Skip to content
Switch branches/tags
Go to file
Cannot retrieve contributors at this time

The Simple GraphQL Service


This is an example CDK stack to deploy The Simple GraphQL Service inspired by Thorsten Hoeger's contributions to the CDK AppSync Module example

An advanced version of this pattern was talked about by Heitor Lessa at re:Invent 2019 as "The Cherry Pick".

This is the most basic of AppSync implementations and would have to be hardened before production use. e.g. cognito user pools configured

Note, never print your API Key to the logs in a production system. This was added to make learning AppSync and GraphQL easier. If you want to use this pattern in a production system remove the two cloudformation outputs


  1. After CDK Deploy, capture outputs from the log.
TheSimpleGraphqlServiceStack: deploying...
TheSimpleGraphqlServiceStack: creating CloudFormation changeset...


TheSimpleGraphqlServiceStack.APIKey = <API Key>
TheSimpleGraphqlServiceStack.Endpoint = https://<endpoint URL>
  1. Setup Postman as outlined in Postman's Using GraphQL Instructions

  2. Set POST request URL, x-api-key and Content-Type

  • x-api-key = 'your API Key'
  • Content-Type = application/graphql


  1. Execute Mutations and Queries to exercice resolvers to dynamo and Lambda datasources


// Inserts to Dynamo
mutation add {
  addCustomer(customer: { name: "CDKPatterns"}) {

// Queries the Dynamo DB
query getCustomers {
  getCustomers{id name}

// Executes the Lambda
query getLoyalty {
  getLoyaltyLevel { level }

Available Versions