Replies: 1 comment 3 replies
-
This sounds great. A couple of things:
|
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Background
Users would like to be able to interact with Workload Discovery without having to use the UI. The main use case for this is to allow for the scripting of importing accounts. However, it would also be possible to programmatically interact with the data in the Neptune database, e.g., listing all the S3 buckets and their related IAM policies and outputting the results to JSON for further processing.
Problem Statement
Currently the only way to interact with the Workload Discovery APIs is by using GraphQL queries. While this is possible, users need to sign the requests with sig4 and handwrite their queries to get the data they want.
Proposal
We will offer a JavaScript SDK that customers can use to to interact programmatically with the Workload Discovery API. This SDK will allow users to invoke queries and mutations with a simple JavaScript function call. The signing of requests will be handled internally by the SDK and will only require that the user runs their program with an IAM role that includes the appropriate permissions (see Appendix A).
Configuration
In order to issue requests to the API the SDK must have access to the URL of the GraphQL. There are two main ways we might do this:
We may also want to provide a different set of APIs depending on whether the customer is using the AWS Organizations integration or not (see Supported GraphQL Operations), so this information would need to be provided too.
User Configuration
The user would provide the required information when creating the client.
Pros:
Cons:
apiUrl
but using the wrongcrossAccountDiscovery
value could cause issues (this issue can be mitigated by implementing the fix proposed in Accounts Removed From AWS Organization Still Appear in UI #396)Automatic configuration
We would use the AWS SDK to query the WD CloudFormation stack to extract the information we need. This will require a change to the
Outputs
section of the main CloudFormation template to export the API URL and cross account discovery mode.Pros:
Cons
Supported GraphQL Operations
We must make a decision as to whether the SDK will support the invocation of all GraphQL operations or not.
All Operations
This option leaves it to users to refrain from using ‘unsafe’ APIs.
Pros:
Cons:
AWS_ORGANIZATION
modeSubset of Operations
In this case, we remove access to any APIs that can write to the Neptune and OpenSearch databases. We also remove access to the APIs that allow users to manage account discovery if WD is running in
AWS_ORGANIZTIONS
mode.The following operations would not be available:
Pros:
Cons:
Pagination
Several of the API queries are paginated, the SDK will provide a mechanism similar to the Amazon JS SDK v3 that allows users to page through the results returned using a
for await...of loop
. The Discovery process already implements this functionality and the way it is used is very similar to this proposal.Appendix A
Required AppSync policy to execute GraphQL operations
Users can further lock down what queries and mutations may be invoked by scoping the Resources field for the appsync:GraphQL action:
Required CloudFormation policy for autoconfiguration
Beta Was this translation helpful? Give feedback.
All reactions