All Projects → amazon-archives → aws-appsync-long-query

amazon-archives / aws-appsync-long-query

Licence: MIT-0 license
Invoke AWS services directly from AWS AppSync via extended HTTP data source support.

Programming Languages

javascript
184084 projects - #8 most used programming language
Vue
7211 projects
HTML
75241 projects

Projects that are alternatives of or similar to aws-appsync-long-query

serverless-appsync-simulator
A simple wrapper around Amplify AppSync Simulator to test serverless AppSync Apis
Stars: ✭ 106 (+324%)
Mutual labels:  aws-appsync
BarsAppAmplify
React Native Bars App: AWS Amplify, AWS AppSync, AWS Cognito, Google Places, Mapbox
Stars: ✭ 29 (+16%)
Mutual labels:  aws-appsync
Amplify Cli
The AWS Amplify CLI is a toolchain for simplifying serverless web and mobile development.
Stars: ✭ 2,399 (+9496%)
Mutual labels:  aws-appsync
Awesome Aws Amplify
Curated list of AWS Amplify Resources
Stars: ✭ 1,650 (+6500%)
Mutual labels:  aws-appsync
aws-appsync-session-manager
AWS AppSync Session Manager - a sample AppSync project
Stars: ✭ 18 (-28%)
Mutual labels:  aws-appsync
ausg-2020-handson-appsync
AWS AppSync로 만드는 서버리스 GraphQL 서비스 (ft. AWS Amplify)
Stars: ✭ 13 (-48%)
Mutual labels:  aws-appsync
aws-appsync-alternative-data-sources
Exploring how AWS AppSync can utilize AWS Lambda to integrate with alternative data sources, including Amazon ElastiCache and Amazon Neptune.
Stars: ✭ 13 (-48%)
Mutual labels:  aws-appsync
react-appsync-graphql-recipe-app
Example application using React + AWS AppSync + GraphQL
Stars: ✭ 71 (+184%)
Mutual labels:  aws-appsync
aws-mobile-appsync-sdk-android
Android SDK for AWS AppSync.
Stars: ✭ 101 (+304%)
Mutual labels:  aws-appsync
react-relay-appsync
AppSync for Relay
Stars: ✭ 19 (-24%)
Mutual labels:  aws-appsync
aws-reinvent-2019-mobile-workshops
AWS re:Invent 2019 Mobile Workshops
Stars: ✭ 72 (+188%)
Mutual labels:  aws-appsync
react-native-appsync-s3
React Native app for image uploads to S3 and storing their records in Amazon DynamoDB using AWS Amplify and AppSync SDK
Stars: ✭ 18 (-28%)
Mutual labels:  aws-appsync
lifemanager
⏱ 한 일을 기록하면 시각화 해서 보여주는 웹 앱⏱
Stars: ✭ 85 (+240%)
Mutual labels:  aws-appsync
nextjs-with-aws-appsync
Demo of a working Next.js with AWS AppSync example
Stars: ✭ 31 (+24%)
Mutual labels:  aws-appsync

AWS Appsync Long Query

Invoke AWS services directly from AWS AppSync via extended HTTP data source support.

AWS AppSync has been extended to support directly calling AWS services via HTTP data sources. AppSync will sign requests using the Signature Version 4 process to authorize requests via AWS IAM. This means you can now call a broad array of AWS services without the need to write an intermediary Lambda function. For example, you could start execution of an AWS Step Functions state machine, retrieve a secret from AWS Secrets Manager, or list available GraphQL APIs from AppSync itself directly from an AppSync resolver.

In this example, we start execution of an AWS Step Function state machine directly from AppSync to demonstrate invoking a long-running query that requires more than the 30-second maximum timeout allowed by AppSync. The state machine executes a one-minute wait before returning a fake result.

AWS AppSync Long Query Architecture

More information can be found in the accompanying blog post.

Getting Started

To get started, clone this repository. The repository contains an AWS SAM Template template, sample client application, and source code to deploy and run the sample.

Prerequisites

To run the sample, you will need to:

  1. Select an AWS region that offers AWS AppSync (currently N. Virginia, Ohio, Oregon, Ireland, Frankfurt, London, Singapore, Tokyo, Sydney, Seoul, and Mumbai).
  2. Install the AWS SAM CLI.
  3. If you would like to run the sample client, you will need to install Vue.js.

Deployment

We will use AWS SAM to deploy cloud resources:

# install node modules
$ cd result && npm install & cd ..

# select a unique bucket name
$ aws s3 mb s3://<UNIQUE_BUCKET_NAME>

# package for deployment
$ sam package --output-template-file packaged.yaml \
              --s3-bucket <UNIQUE_BUCKET_NAME>

# deploy cloud resources
$ sam deploy --template-file packaged.yaml \
             --stack-name appsync-long-query \
             --capabilities CAPABILITY_NAMED_IAM

Once deployment is finished, we can collect a few items to configure the sample client application. Open the file client/src/aws-config.js in your favorite text editor. Set the value of aws_appsync_region to the region you selected (e.g. N. Virginia = us-east-1). Set the other values by retrieving output data from the SAM stack:

# aws_appsync_graphqlEndpoint
$ aws cloudformation describe-stacks --stack-name appsync-long-query \
             --query 'Stacks[0].Outputs[?OutputKey==`ApiEndpoint`].OutputValue'

# aws_appsync_apiKey
$ aws cloudformation describe-stacks --stack-name appsync-long-query \
             --query 'Stacks[0].Outputs[?OutputKey==`ApiKey`].OutputValue'

After saving your changes, start the sample Vue application:

$ cd client && npm install
$ npm run serve

Open your browser and navigate to http://localhost:8080. Click the "Search" button. View the initial response from your GraphQL API, which will automatically update the final result after approximately one minute. Use your browser's developer tools to review the Console and Network requests.

Sample Client

Cleaning Up

Once finished, feel free to clean-up the sample code:

$ aws cloudformation delete-stack \
             --stack-name appsync-long-query

$ aws s3 rm s3://<UNIQUE_BUCKET_NAME>

Thanks!

License Summary

This sample code is made available under a modified MIT license. See the LICENSE file.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].