AWS Signature V4 tests in GO

This repository contains two http.RoundTripper implementations to sign requests using AWS Signature V4:

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/credentials with 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_elastic

or:

ELASTIC="https://your-elastic-endpoint.us-east-1.es.amazonaws.com" go test -v -run TestSignV4SDKV2_RoundTrip_elastic