This repository contains two http.RoundTripper implementations to sign requests using AWS Signature V4:
- SignV4SDKV1, using aws-sdk-go
- SignV4SDKV2, using aws-sdk-go-v2
The tests TestSignV4SDKV1_RoundTrip_elastic and TestSignV4SDKV1_RoundTrip_elastic (in elasticexample_test.go) show
how to use SignV4SDKV1 and SignV4SDKV2 with the Elastic client. The
tests get information from an Elastic cluster running in AWS, printing the request and its output. To run the examples
you need:
- An Elastic cluster running in AWS Elasticsearch Service.
- User credentials in
~/.aws/credentialswith access to the Elastic cluster.
Get your Elastic cluster endpoint and run:
ELASTIC="https://your-elastic-endpoint.us-east-1.es.amazonaws.com" AWS_SDK_LOAD_CONFIG=1 go test -v -run TestSignV4SDKV1_RoundTrip_elasticor:
ELASTIC="https://your-elastic-endpoint.us-east-1.es.amazonaws.com" go test -v -run TestSignV4SDKV2_RoundTrip_elastic