Authorization when uploading image to s3 bucket using Android
I used the below code to load image into s3 bucket using android.
AmazonS3 s3client = new AmazonS3Client(new BasicAWSCredentials(context.getString(R.string.accesskey),context.getString(R.string.secretkey)));
PutObjectResult result = s3client.putObject(new PutObjectRequest(bucketName, amazonfilepath, file).withAccessControlList(acl));
When I create a bucket in the Asia Pacific regions (Singapore) then it works great. But I have to change the bucket areas to Asia Pacific (Mumbai) then it throws below error.
Amazon s3 image download: com.amazonaws.services.s3.model.AmazonS3Exception: The authorization mechanism you provided is not supported. Please use AWS4-HMAC-SHA256. (Service: Amazon S3; Status Code: 400; Error Code: Invalid Request; Request ID: 85D0346520B14007), S3 Extended Request ID: gC67avqeowqS4 + X + 2qkBxzLxfj9ABVV22zWgPcm / rZBKC0RIso201 + eMsvBsJ8V09H
source to share
Confirmed updating sdk to latest version fixed. in my case
implementation 'com.amazonaws:aws-android-sdk-core:2.6.13'
implementation 'com.amazonaws:aws-android-sdk-s3:2.6.13'
if you have the same problem check aws sdk version in build.gradle file at app level.
Just answering a question, someone comes here looking for it.
source to share