Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Support sigv4a #217

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

NathanRoseCE
Copy link

** Problem **

This library is a key tool in dev testing aws services particular self hosted api gateway instances as it has strong integration with api gateway.

However there can be problems in using this in high availability multi-region solutions built on top of AWS due to the fact that in these situations it is not always easy to determine what the region you will be talking to will be at request signing time.

Luckily AWS introduced sigv4a to solve this problem and allow flexibilty, this Pull Request impliments sigv4a for awscurl

** Solution **

This is a minimal proposed fix that pulls in logic written in amazon and vended out to do most of the heavy lifting. pulling a dependency on awscrt for the credential logic.

This is largely based off of the example for sigv4a from aws: here.

** Testing **

I hit an endpoint for an API Gateway instance in us-west-2, below was the outcome

docker run --rm -ti -v "$HOME/.aws:/root/.aws" -e AWS_ACCESS_KEY_ID -e AWS_SECRET_ACCESS_KEY -e AWS_SECURITY_TOKEN -e AWS_PROFILE -e AWS_REGION awscurl  "https://my.apigateway.instance.dev" --region '*'
{"redacted": "test data :D"}

** Problem **

This library is a key tool in dev testing aws services particular self
hosted api gateway instances as it has strong integration with api
gateway.

However there can be problems in using this in high availability
multi-region solutions built on top of AWS due to the fact that in
these situations it is not always easy to determine what the region
you will be talking to will be at request signing time.

Luckily AWS introduced sigv4a to solve this problem and allow
flexibilty, this Pull Request impliments sigv4a for awscurl

** Solution **

This is a minimal proposed fix that pulls in logic written in amazon
and vended out to do most of the heavy lifting. pulling a dependency
on awscrt for the credential logic.

This is largely based off of the example for sigv4a from aws:
[here](https://github.com/aws-samples/sigv4a-signing-examples/tree/main/python).

** Testing **

I hit an endpoint for an API Gateway instance in us-west-2, below was
the outcome

```
docker run --rm -ti -v "$HOME/.aws:/root/.aws" -e AWS_ACCESS_KEY_ID -e AWS_SECRET_ACCESS_KEY -e AWS_SECURITY_TOKEN -e AWS_PROFILE -e AWS_REGION awscurl  "https://my.apigateway.instance.dev" --region '*'
{"redacted": "test data :D"}
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants