Aws-sdk-php: Exception while uploading to s3 : "Are you sure you are using the correct region for this bucket?"

Created on 27 Oct 2015  Â·  4Comments  Â·  Source: aws/aws-sdk-php

I have defined in options the 'region' parameter while initiating s3client object, but still getting this error:
"Encountered a permanent redirect while requesting https://s3-us-west-2.amazonaws.com/mybucketname/mykey. Are you sure you are using the correct region for this bucket? "
Code:

$this->s3Client = new \Aws\S3\S3Client([
            'version' => 'latest',
            'region' => 'us-west-2',
            'credentials' => [
                'key' => $this->accessKey,
                'secret' => $this->secretKey
            ],
            'debug' => false
        ]);

Most helpful comment

us-east-1 worked for me.

All 4 comments

In which region is the bucket you're uploading to located?

'region' => 'eu-west-1'

Thanks & Regards,
Manish Motwani
_http://ManishMotwani.com http://manishmotwani.com/_

On 27 October 2015 at 21:01, Jonathan Eskew [email protected]
wrote:

In which region is the bucket you're uploading to located?

—
Reply to this email directly or view it on GitHub
https://github.com/aws/aws-sdk-php/issues/805#issuecomment-151542094.

You'll need to interact with the bucket using a client scoped to the region in which the bucket resides. The error should disappear if you change the region to 'eu-west-1' in the code snippet posted above.

us-east-1 worked for me.

Was this page helpful?
0 / 5 - 0 ratings