HUB
Sign inSign up

lalyos/graphql-aws

By lalyos

•Updated almost 9 years ago

Image
0

522

lalyos/graphql-aws repository overview

⁠AWS Cloud API via GraphQL

⁠Usage

⁠Demo webserver

To get familiar with GraphQL, its probably best to start with an interactive web interface:

docker run -p 4000:4000 lalyos/graphql-aws --demo

You can play with GraphiQL on http://localhost:4000⁠. It has autocompletion on Ctrl-Space

⁠Cli
graphql() { 
  docker run -i --rm \
    -e AWS_ACCESS_KEY_ID \
    -e AWS_SECRET_ACCESS_KEY \
    -e AWS_DEFAULT_REGION \
    lalyos/graphql-aws 
}
$ cat > instances.graphql << "EOF"
query instances($AWS_DEFAULT_REGION: String, $AWS_ACCESS_KEY_ID: String, $AWS_SECRET_ACCESS_KEY: String) {
  aws(config: {accessKeyId: $AWS_ACCESS_KEY_ID, secretAccessKey: $AWS_SECRET_ACCESS_KEY, region: $AWS_DEFAULT_REGION}) {
    ec2 {
      describeInstances {
        Reservations {
          Instances {
            InstanceId
            PublicIpAddress
            VpcId
          }
        }
      }
    }
  }
}
EOF
$ graphql < instances.graphql

## format output with jq
$ cat instances.graphql | graphql | jq .

⁠GraphiQL customization

I wanted to have a customized graphiQL editor, where I can change the initial sample query displayed as a comment in the left pane of the browser.

The minified version of the renderGraphiQL.js gets installed into ./node_modules/express-graphql/dist/renderGraphiQL.js

So the original defaultQuery⁠ is copied into a local file defaultQuery ant the modifies version is getting inserted into ./node_modules/express-graphql/dist/renderGraphiQL.js by sed magic in Dockerfile⁠

Tag summary
Recent tags
Content type
Image
Digest
Size
73.3 MB
Last updated
almost 9 years ago
docker pull lalyos/graphql-aws:latest