Below is my code
AmazonS3 s3 = new AmazonS3Client(credentials,config); // assume proper authentication
// generating URL for some bucket(XYZ) and key(test/abc.txt)
java.util.Date expiration = new java.util.Date();
expiration.setTime(6000*10*20);
GeneratePresignedUrlRequest generateUrl = new GeneratePresignedUrlRequest("XYZ", "test/abc.txt");
generateUrl.setMethod(HttpMethod.GET); // Default.
generateUrl.setExpiration(expiration);
URL url = s3.generatePresignedUrl(generateUrl);
o/p of above code is
https://s3.amazonaws.com/XYX/test/abc.txt?AWSAccessKeyId=XXXXXXXXXXXXXXXXX&Expires=1200&Signature=YYYYYYYYYYYYYYYYY
Using above URL I am trying to download abc.txt but I am get error 403 (Server returned HTTP response code: 403 for URL:)
Please let me know how i can download files using URL from amazon s3.