Donato  Roob

Donato Roob


AWS AppSync with GraphQL

Yesterday at reInvent, Amazon launched AppSync, a new GraphQL service featuring real-time updates and built-in offline support. Managed in the AWS console, AppSync’s GraphQL layer aggregates data from other AWS products such as ElasticSearch and DynamoDB. In your application, you query your GraphQL API with the AppSync Client, available for web and native.



What is GEEK

Buddha Community

AWS AppSync with GraphQL
Fredy  Larson

Fredy Larson


AWS AppSync: Conditional Resolvers Using the Info Context

AWS AppSync

AppSync is a managed GraphQL service offered by Amazon Web Services and can be used to build scalable enterprise APIs. A typical AppSync solution consists of small resolvers that can be combined to access various data sources such as databases, HTTP APIs or AWS Lambda.


In this example, I will be talking about using AWS AppSync with AWS Lambda data sources and one of the challenges I have come across while developing enterprise scale solutions with these technologies.

Each Lambda resolver you have in a particular request triggers an invocation. The problem comes with having nested resolvers where you only request data from the nested Lambda rather than the parent Lambda. As a result you will cause several invocations, incur cost and resource for the first Lambda without needing to.

If you’re running enterprise serverless it is important to consider the architecture to reduce the amount of compute where possible and lower the risk of hitting limits imposed by AWS.

Thankfully, AWS released an AppSync update in Feb 2020 giving us access to the context info object so we can mitigate this issue. Read more here.

Let’s dive in! 💥

Say you have a GraphQL endpoint and schema to retrieve a typical blog post:

type Post{
  id: ID!
  title: String!
  content: String!
  image: ImageData!
type ImageData{
  id: ID!
  postId: ID!
  path: String!
  tags: String
type Query{
  getPost(id: ID!): Post!

Using GraphQL, your query could look like:

query GetPost{
  getPost(id: $id){

#aws-appsync #graphql #aws-lambda #serverless #aws

Chaz  Homenick

Chaz Homenick


Effective Direct Lambdas for AWS AppSync (Spoiler: They Are Really Effective)

Today, I’m going to walk you through using AppSync’s Direct Lambda feature. I built the thing during my internship this Summer after all, so I should be able to express how simple, yet effective, this feature is in allowing you to configure Lambdas for your API on AppSync.

_Go ahead and jump to the section labelled __Let there be an API! _if you’d like to skip the bits about what the old workflow for a Lambda resolver was like.

I’d first like to make a point about why Direct Lambdas were necessary. Here’s a picture to help demonstrate that point.

Image for post

VTL? Cancelled, sorta. Call the mob.

In order to set up a Lambda resolver for a field on AppSync, you’d first have to check out the resolver mapping template reference, then you’d have to set up your mapping templates in a language called VTL. These templates translate data back and forth between your Lambda. Finally, you’d be able to set up your Lambda to expect the data as translated by the mapping templates.

Notice that I mentioned that you had to write code in two separate places: the Lambda and the mapping templates, which might be in the Appsync console editors, uploaded through the SDK, or in a CloudFormation template. This introduces unnecessary coupling between your Lambda code and your mapping templates, which is probably not optimal for your code-base, nor your mental health.

This is where the problem lies: if it’s at all complicated, then it’s too complicated. The goal is to think less… Er, less about things that don’t matter, that is.

If only there was an easier way to configure a Lambda resolver on AppSync. If only there was a way to write less code and get more done.

There is now a way, Direct Lambdas.

Image for post

This is probably how things work under the hood.

Let there be an API!

I’d like to avoid making this tutorial dry and boring so I’ve decided that our API will be all about awesome, original, definitely-not-cringe dad jokes! Plus, we can utilize a friendly API called icanhazdadjokes that offers an unprecedented collection of definitely-not-cringe-worthy dad jokes for free. That’s a low price!

Let’s start off with a specification of what our API should do. I’d like to create an API that will allows a client to either get a random Joke or get a Joke specified by an ID.

What makes up a Joke?

  • joke: The content of the joke
  • id: The id of the joke
  • imageUrl: A permalink to the joke
  • cringe: A boolean that shows if the joke is cringe or not

Here’s how the entire thing will work:

Image for post

#aws #graphql #serverless #aws-lambda #aws-appsync

Landen  Brown

Landen Brown


AWS Amplify - AWS AppSync GraphQL Codegen Demo

The AWS Amplify CLI toolchain now automatically generates your GraphQL queries, mutations, & subscriptions as well as a typed API file containing your Schema. In this video, we walk through how to use it.

#graphql #aws appsync #aws amplify #codegen

Landen  Brown

Landen Brown


Creating AWS AppSync GraphQL APIs with AWS Amplify

In this video, we walk through how to create a new AWS AppSync GraphQL API & connect to it from a client-side application.

#aws amplify #aws appsync #graphql

Landen  Brown

Landen Brown


Gatsby Static GraphQL Queries with AWS Amplify & AWS AppSync

In this video we’ll build a Game of Thrones app using AWS AppSync & the Gatsby Source GraphQL plugin. We’ll learn how to create the GraphQL api, install & configure Gatsby Source GraphQL, & deploy the app with the static GraphQL data available to render in the app.

#aws appsync #aws amplify #graphql