GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - lucidprogrammer/graphql-lambda-terraform: Sample GraphQL packaged as aws lambda deployment to aws api gateway using terraform

BranchesTags
Open more actions menu

Latest commit

 

History

1 Commit
1 Commit

Folders and files

NameName
Last commit message
Last commit date
build
build
 
 
infrastructure
infrastructure
 
 
src/graphql
src/graphql
 
 
test
test
 
 
.gitattributes
.gitattributes
 
 
.gitignore
.gitignore
 
 
README.md
README.md
 
 
graphql_server.js
graphql_server.js
 
 
main.tf
main.tf
 
 
package.json
package.json
 
 
variables.tf
variables.tf
 
 
yarn.lock
yarn.lock
 
 

Repository files navigation

Overview

This is an example graphql endpoint packaged as a aws lambda function deployed to an aws api gateway. All the infrastructure required is provisioned using terraform, only thing you need to use this is your AWS credentials.

The code is structured to hold more than one lambda function. i.e. Currently the src/ folder contains only graphql folder. You can add additional lambda functions, and modify the main.tf if needed.

The sample here does not use terraform backend configuration. For production, it is advisable to use a backend like S3.

Configure and Create graphql endpoint using Aws Lambda and Aws api_gateway

Prerequisites

Make sure you have installed terraform & zip installed.

Clone this repo & install dependencies

Set environment variables.

export TF_VAR_aws_access_key=yourawsaccesskey
export TF_VAR_aws_secret_key=yourawssecretkey
export TF_VAR_region=awsregion

Run locally

yarn run graphql-server

Deploy infrastructure

If you wish to change names of variables, for example, path or name of api etc, review variables.tf. But not mandatory.

Run the following command.

yarn run test-deploy

You should see the url where the deployment is available. Take a note of that and use in the following steps to test it.

From your browser

Just browse to the url path output you received in the previous step

Using Curl

//_url_ is the url you received while running the script.
curl -X POST _url_ -d '{"query": "{users{firstName} }" }' -H 'Content-Type: application/json'

Using AWS API Test Console

Select Method as POST in the dropdown list.

Query String, provide the following

query= "{users{firstName} }"

Headers, provide the following,

Content-Type: application/json

Click Test button.

About

Sample GraphQL packaged as aws lambda deployment to aws api gateway using terraform

Topics

awsaws-apigatewayaws-lambdagraphqliaciac-scriptsterraform

Resources

Readme
Activity

Stars

7 stars

Watchers

0 watching

Forks

4 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.