Create AWS s3 bucket with null region

0 votes

There is a Java stacktrace error that implies there is an S3 Bucket with null region.

I tried to re-create the error and a null-region s3 bucket with no success.

com.amazonaws.services.s3.model.AmazonS3Exception: The bucket is in this region: null.Please use this region to retry the request (Service: Amazon S3; Status Code: 301; Error Code: PermanentRedirect; Request ID: EA0959BA1B1D56A7)
        at com.amazonaws.http.AmazonHttpClient.handleErrorResponse(AmazonHttpClient.java:1372)
        at com.amazonaws.http.AmazonHttpClient.executeOneRequest(AmazonHttpClient.java:919)
        at com.amazonaws.http.AmazonHttpClient.executeHelper(AmazonHttpClient.java:697)
        at com.amazonaws.http.AmazonHttpClient.doExecute(AmazonHttpClient.java:449)
        at com.amazonaws.http.AmazonHttpClient.executeWithTimer(AmazonHttpClient.java:411)
        at com.amazonaws.http.AmazonHttpClient.execute(AmazonHttpClient.java:360)
        at com.amazonaws.services.s3.AmazonS3Client.invoke(AmazonS3Client.java:3962)
        at com.amazonaws.services.s3.AmazonS3Client.getBucketPolicy(AmazonS3Client.java:2544)
        at com.amazonaws.services.s3.AmazonS3Client.getBucketPolicy(AmazonS3Client.java:2504)

Oct 31, 2018 in AWS by findingbugs
• 3,170 points
277 views

1 answer to this question.

0 votes

It is almost similar and It occurs when your AmazonS3Client is set to a different region then the bucket you are calling.

def s3Client = new AmazonS3Client(new BasicAWSCredentials("accessKey", "secretKey"))
s3Client.setRegion(com.amazonaws.regions.Region.getRegion( Regions.AP_NORTHEAST_1) )
def policy = s3Client.getBucketPolicy('joshuacalloway-us-east-1-bucket')
println policy

--> results in

Result: com.amazonaws.services.s3.model.AmazonS3Exception: The bucket is in this region: null. Please use this region to retry the request (Service: Amazon S3; Status Code: 301; Error Code: PermanentRedirect; Request ID: 5F941FB57305BDEC), S3 Extended Request ID: xajT6YydJU+EfoOFWtD4SFiaxS7zoOUS9OKAmFVq/CECmoNuCbcDu4q7z4L+kztbyrMxb5c/Bcw=
    at com.amazonaws.http.AmazonHttpClient$RequestExecutor.handleErrorResponse(AmazonHttpClient.java:1543)
    at com.amazonaws.http.AmazonHttpClient$RequestExecutor.executeOneRequest(AmazonHttpClient.java:1181)
    at com.amazonaws.http.AmazonHttpClient$RequestExecutor.executeHelper(AmazonHttpClient.java:962)
answered Oct 31, 2018 by Priyaj
• 56,900 points

Related Questions In AWS

0 votes
1 answer
0 votes
1 answer

How to create a S3 bucket using AWS CLI?

You can use the following command:- C:\Users\priyj_kumar>aws s3api ...READ MORE

answered Feb 15 in AWS by Priyaj
• 56,900 points
806 views
+1 vote
3 answers

Which is better ? AWS S3 bucket logs vs AWS cloudtrail

CloudTrail logs API calls accessed to your ...READ MORE

answered Aug 16, 2018 in AWS by Priyaj
• 56,900 points
2,116 views
0 votes
1 answer

AWS S3 uploading hidden files by default

versioning is enabled in your bucket. docs.aws.amazon.com/AmazonS3/latest/user-guide/….... the ...READ MORE

answered Oct 4, 2018 in AWS by Priyaj
• 56,900 points
291 views
0 votes
1 answer

How to decrypt the encrypted S3 file using aws-encryption-cli --decrypt

Use command : aws s3 presign s3://mybucket/abc_count.png you get ...READ MORE

answered Oct 22, 2018 in AWS by Priyaj
• 56,900 points
660 views
0 votes
1 answer

Import my AWS credentials using python script

Using AWS Cli  Configure your IAM user then ...READ MORE

answered Nov 16, 2018 in AWS by Jino
• 5,560 points
458 views
0 votes
2 answers
0 votes
1 answer

Invalid Bucket name when creating s3 bucket with AWS SDK

AWS provides naming standards when naming an ...READ MORE

answered Aug 30, 2018 in AWS by Priyaj
• 56,900 points
465 views
+1 vote
1 answer

Create S3 bucket using Java AWS SDK

Hey @Anjali, Creating a bucket using Java AWS-SDK ...READ MORE

answered Jan 23 in AWS by Priyaj
• 56,900 points
243 views