This code block solved my problem and thanks to it, i can send simple signed http requests.
BasicSessionCredentials credentials = new BasicSessionCredentials(accessKey, secretKey, sessionToken);
AmazonWebServiceRequest amazonWebServiceRequest = new AmazonWebServiceRequest() {
};
ClientConfiguration clientConfiguration = new ClientConfiguration();
Request request = new DefaultRequest(amazonWebServiceRequest,Constants.API_GATEWAY_SERVICE_NAME);
request.setEndpoint(URI.create(posturl));
request.setHttpMethod(HttpMethodName.POST);
AWS4Signer signer = new AWS4Signer();
signer.setServiceName(Constants.API_GATEWAY_SERVICE_NAME);
signer.setRegionName(Region.getRegion(Regions.US_WEST_2).getName());
signer.sign(request, credentials);
AmazonCustomWebClient webClient = new AmazonCustomWebClient(clientConfiguration, mContext);
webClient.Execute(request, new HttpResponseHandler<AmazonWebServiceResponse<String>>() {
@Override
public AmazonWebServiceResponse<String> handle(HttpResponse response) throws Exception {
return null;
}
@Override
public boolean needsConnectionLeftOpen() {
return false;
}
});
API_GATEWAY_SERVICE_NAME constant is important for api gateway request it is 'execute-api', and AmazonCustomWebClient is derived from AmazonWebServiceClient.