Skip to content

graphql-compose/graphql-compose-aws

Folders and files

NameName
Last commit message
Last commit date

Latest commit

1c1cb73 · Sep 14, 2022

History

51 Commits
Jun 23, 2021
Feb 15, 2020
Sep 14, 2022
Sep 14, 2022
Aug 17, 2020
Apr 30, 2021
Jun 26, 2018
Mar 15, 2019
Nov 30, 2017
Apr 28, 2019
Nov 30, 2017
Nov 30, 2017
Mar 15, 2019
Aug 17, 2020
Jun 23, 2021
Aug 17, 2020
Aug 17, 2020
Jun 23, 2021

Repository files navigation

graphql-compose-aws

npm trends Travis Commitizen friendly semantic-release Greenkeeper badge

This module expose AWS Cloud API via GraphQL.

Generated Schema Introspection in SDL format can be found here (more than 10k types, ~2MB).

AWS SDK GraphQL

Supported all AWS SDK versions via official aws-sdk js client. Internally it generates Types and FieldConfigs from AWS SDK configs. You may put this generated types to any GraphQL Schema.

import { GraphQLSchema, GraphQLObjectType } from 'graphql';
import awsSDK from 'aws-sdk';
import { AwsApiParser } from 'graphql-compose-aws';

const awsApiParser = new AwsApiParser({
  awsSDK,
});

const schema = new GraphQLSchema({
  query: new GraphQLObjectType({
    name: 'Query',
    fields: {
      // Full API
      aws: awsApiParser.getFieldConfig(),

      // Partial API with desired services
      s3: awsApiParser.getService('s3').getFieldConfig(),
      ec2: awsApiParser.getService('ec2').getFieldConfig(),
    },
  }),
});

export default schema;

Full code examples

Installation

yarn add graphql graphql-compose aws-sdk graphql-compose-aws
// or
npm install graphql graphql-compose aws-sdk graphql-compose-aws --save

Modules graphql, graphql-compose, aws-sdk are in peerDependencies, so should be installed explicitly in your app.

Screenshots

Get List of EC2 instances from eu-west-1 region

screen shot 2017-12-03 at 18 19 28

Several AWS API calls in one query with different services and regions

screen shot 2017-12-03 at 18 07 50

License

MIT