Skip to content

Getting Error Code: 301 Moved Permanently #1366

@Cheng-Lin

Description

@Cheng-Lin

We are doing AWS Java SDK upgrades, and we bumped it to version 1.11.x. In addition, we started to use AmazonS3Builder to construct our S3 client. Here's part of the code:

    AmazonS3 s3Client = new AmazonS3ClientBuilder()
            .withEndpointConfiguration(
                    new EndpointConfiguration("s3-us-west-2.amazonaws.com", ""us-west-2"))
            .build());

for our fleet in us-west-2. All our services needs to be able to read/write data to buckets located in different, but when we are trying to read data in us-east-1 with the above client, we are getting the following exception:

    Caused by: com.amazonaws.services.s3.model.AmazonS3Exception: The bucket is in this region: us-east-1. Please use this region to retry the request (Service: Amazon S3; Status Code: 301; Error Code: 301 Moved Permanently; Request ID: xxxxxxxx), S3 Extended Request ID: xxxxxxxxx

Anyone else had a similar problem before? How can we use the same S3 client to write to different region? We don't want to have multiple clients (one per region) as it would increase the complexity of our code.

Thanks for the help,
Cheng Lin

Metadata

Metadata

Assignees

No one assigned

    Labels

    guidanceQuestion that needs advice or information.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions