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,260 points
2,845 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
• 58,020 points

Related Questions In AWS

0 votes
1 answer

How to create a S3 bucket in AWS Console?

To create a S3 bucket in AWS, ...READ MORE

answered Feb 13, 2019 in AWS by Priyaj
• 58,020 points
1,155 views
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, 2019 in AWS by Priyaj
• 58,020 points
6,127 views
0 votes
2 answers

Create an S3 bucket using CloudFormation - AWS

Hey you can create an S3 bucket ...READ MORE

answered Aug 19, 2020 in AWS by Preeti

edited Aug 19, 2020 15,852 views
0 votes
1 answer

Create an S3 bucket in a specific region from the command line.

Hi@akhtar, You can use LocationConstraint in your command. ...READ MORE

answered Oct 7, 2020 in AWS by MD
• 95,460 points
2,671 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
• 58,020 points
5,958 views
–1 vote
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
• 58,020 points
5,204 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,820 points
2,868 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
• 58,020 points
4,506 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, 2019 in AWS by Priyaj
• 58,020 points
2,570 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP