URI uri = new URI(baseUrl);
request.setEndpoint(uri);
String resourcePath=urlString.substring(baseUrl.length(), urlString.indexOf("?"));
request.setResourcePath(resourcePath);
AWS4Signer aws4Signer=new AWS4Signer();
String host = uri.getHost();
aws4Signer.setServiceName(host);
aws4Signer.sign(request, awsCredentials);
//set headers for real request
for (Entry <String, String>entry:request.getHeaders().entrySet()){
conn.setRequestProperty(entry.getKey(),entry.getValue());
}