This is a NestJS application module which provides a GraphQL implementation for frontend applications on top of aws-sdk-v3.
![IDE Preview](https://github.com/devopstation/graph/raw/HEAD/./assets/ide-preview.png)
Features
- Asynchronous / Reliable BULK Operations
Coverage
S3
- Bucket - list / create / delete
- Object - list / delete / download / upload
EC2
- Instance - list / start / stop / connect (SSH - xterm)
IAM
Installation
npm install @devopstation/graph
OR using YARN
yarn add @devopstation/graph
Usage
Execute the server
WARNING: RUNNING THE SERVER ALLOWS CLIENTS ON THE SAME NETWORK TO USE YOUR AWS-LOCAL PROFILES AND THE UNDERLINE RESOURCES. (DEFAULT NETWORK IS 127.0.0.1 / LOCALHOST)
Simple run the package binary file:
$ devopstation-graph
[Nest] 15921 - 07/20/2021, 12:15:11 PM [NestFactory] Starting Nest application...
[Nest] 15921 - 07/20/2021, 12:15:11 PM [InstanceLoader] AppModule dependencies initialized +54ms
[Nest] 15921 - 07/20/2021, 12:15:11 PM [InstanceLoader] CoreModule dependencies initialized +0ms
[Nest] 15921 - 07/20/2021, 12:15:11 PM [InstanceLoader] CredentialsModule dependencies initialized +1ms
[Nest] 15921 - 07/20/2021, 12:15:11 PM [InstanceLoader] StorageModule dependencies initialized +2ms
[Nest] 15921 - 07/20/2021, 12:15:11 PM [InstanceLoader] GraphQLSchemaBuilderModule dependencies initialized +0ms
[Nest] 15921 - 07/20/2021, 12:15:11 PM [InstanceLoader] GraphQLModule dependencies initialized +1ms
[Nest] 15921 - 07/20/2021, 12:15:11 PM [RoutesResolver] StorageController {/storage}: +10ms
[Nest] 15921 - 07/20/2021, 12:15:11 PM [RouterExplorer] Mapped {/storage/upload/object, POST} route +1ms
[Nest] 15921 - 07/20/2021, 12:15:11 PM [NestApplication] Nest application successfully started +225ms
Server is running.
server is running now by default under the URL:
http://localhost:3000/graphql
ENVIRONMENT VARIABLES
AWS_GRAPH_HOST
default: 127.0.0.1
AWS_GRAPH_PORT
default: 3000
NODE_ENV
default: production
values: development
| production
determines the following (development):
- debug
- playground / apollo graphql IDE exposure
- auto-schema
all above are disable under production
node-environment.
Usage
The server uses the standard credential profiles of aws-sdk-v3, to a profile it is necessary to manually append the .aws/credentials
file.
All resource specific queries and mutations need profile AND region selection via HEADERS:
x-aws-account = <profile-name>
x-aws-region = <region: (us-east-1 | eu-central-1) etc.>
To request the all host profiles run the following query
query accounts {
accounts {
name
accessKeyId
info {
arn
}
lastUsed {
date
serviceName
region
}
}
}
Note: This query does not require profile OR region selection
Note: for security reasons the server does not expose SECRETS such as aws-secret-key
etc.