aws / aws-tools-for-powershell

The AWS Tools for PowerShell lets developers and administrators manage their AWS services from the PowerShell scripting environment.
Apache License 2.0
245 stars 82 forks source link

Invoke API Gateway with IAM Auth request signing #180

Open ghost opened 4 years ago

ghost commented 4 years ago

I'd like a way to call a API Gateway method/resource that has IAM Auth enabled. This requires signing the request in the AWS Signature V4 process, which is very cumbersome.

This similar request for a .NET method looks unfulfilled.

Describe the Feature

API Gateway is a great solution for all REST clients, including PowerShell Invoke-RestMethod. However if we'd like to enable AWS_IAM auth on a method/resource, I'm not aware of a realistic way to use PowerShell as a client.

Is your Feature Request related to a problem?

No

Proposed Solution

I see two directions we could go.

  1. An AWS-service-agnostic cmdlet that, given all the required inputs (credentials, URL, etc), and will return a hashtable of headers to use in, for example, Invoke-RestMethod.
  2. An API Gateway specific cmdlet that is nearly identical to Invoke-RestMethod, but accepts AWS credentials/profile/etc and will do the signing for you. Invoke-AG2RestMethod?

Describe alternatives you've considered

I've spent a few hours trying to write my own signer method, but it is, as previously mentioned, very cumbersome.

Additional Context

API Gateway and Lambda are incredibly useful for providing simple REST interfaces. IAM auth is something already widely adopted for AWS reasons, and thus is the most convenient authorizer without having to get into Cognito, auth tokens, or other methods.

This is a :rocket: Feature Request

dhenard commented 3 years ago

Would also be interested in being able to send web requests to an AWS API Gateway with AWS_IAM authentication enabled.

ghost commented 3 years ago

@dhenard Please thumbs-up my original request. Thanks!

ashishdhingra commented 2 years ago

Needs review with the team.

markjl-netlogix commented 5 months ago

Adding a +1 for this feature