I'd like to use the AmazonAWS TransferManager to upload a directory. I successfully create an AmazonS3Client with credentials coming from a TVM.
When I try to download files with it, it complains:
final MultipleFileDownload fileDownloadd=mTransferManager.downloadDirectory(ChanAuth.getBucketName(), remotePath, file);
AWS Error Code: PermanentRedirect, AWS Error Message: The bucket you are attempting to access must be addressed using the specified endpoint. Please send all future requests to this endpoint
I've read about the subject, and experienced it in the past in other programming languages. I remember it has relation on where you do the final "post" when issuing S3 commands (I had to post directly to my bucket url). But the error comes from deep into the AWS SDK and should be handled there.
My buckets are located on the EU-WEST-1 region.
I initialize the client both with
s3Client.setRegion(Regions....(Region.EU_WEST_1))
and
s3Client.setEndpoint("s3-eu-west-1.amazonaws.com");
but I always get TransferManager complaining.
I suspect it must be a silly issue, but I'm getting stuck in the million lines and methods of the AwS SDK. There has to be somewhere to set the endpoint correctly or the sdk wouldnt work for buckets outside the US-region.
Help Appreciated :)
06-09 20:16:02.810: D/SynchroService(4408): MESSAGE: nicebeat SYNC
06-09 20:16:02.810: D/SynchroService(4408): MESSAGE: downlading from chd68f38e7d1360dc1d999354da4f98601/nicebeat/story/sonidonia to /mnt/sdcard/Android/data/com.regaliz.libneo/files/nicebeat/story/sonidonia/lib
06-09 20:16:02.810: D/SynchroService(4408): is directory? true
06-09 20:16:03.490: W/System.err(4408): AmazonS3Exception: Status Code: 301, AWS Service: Amazon S3, AWS Request ID: 2695AE32DC39077E, AWS Error Code: PermanentRedirect, AWS Error Message: The bucket you are attempting to access must be addressed using the specified endpoint. Please send all future requests to this endpoint., S3 Extended Request ID: j9zQ8EBzkCGHkRTveri82HoA/Yh9PvJofUPtNJlc9oKrVutG0VjNEGG90WnTGaN4
06-09 20:16:03.490: W/System.err(4408): at com.amazonaws.http.AmazonHttpClient.handleErrorResponse(AmazonHttpClient.java:633)
06-09 20:16:03.490: W/System.err(4408): at com.amazonaws.http.AmazonHttpClient.executeHelper(AmazonHttpClient.java:327)
06-09 20:16:03.490: W/System.err(4408): at com.amazonaws.http.AmazonHttpClient.execute(AmazonHttpClient.java:179)
06-09 20:16:03.490: W/System.err(4408): at com.amazonaws.services.s3.AmazonS3Client.invoke(AmazonS3Client.java:2980)
06-09 20:16:03.490: W/System.err(4408): at com.amazonaws.services.s3.AmazonS3Client.invoke(AmazonS3Client.java:2951)
06-09 20:16:03.490: W/System.err(4408): at com.amazonaws.services.s3.AmazonS3Client.listObjects(AmazonS3Client.java:479)
06-09 20:16:03.490: W/System.err(4408): at com.amazonaws.services.s3.transfer.TransferManager.downloadDirectory(TransferManager.java:588)
06-09 20:16:03.490: W/System.err(4408): at com.regaliz.services.Synchro.downloadDirectory(Synchro.java:156)
06-09 20:16:03.490: W/System.err(4408): at com.regaliz.services.Synchro.request_commands(Synchro.java:99)
06-09 20:16:03.490: W/System.err(4408): at com.regaliz.services.Synchro$3.run(Synchro.java:195)