2 Answers
- Newest
- Most votes
- Most comments
0
You must first verify if the AWS S3 bucket name you've assigned through the PHP code isn't already in use.
Try creating the AWS S3 bucket in the AWS Console with that name to confirm.
answered a year ago
0
Hi
Could you verify the region specified when creating the client? If the specified region on the client is different than what is LocationConstraint we can face this error.
If there is no region defined in the client add the same region as the LocationConstraint and try.
$s3Client = new S3Client([ 'profile' => 'default', 'region' => 'eu-west-2', 'version' => '2006-03-01' ]);
answered a year ago
Yes I have verified the client is eu-west-2 in the client. Indeed my original code did not include locationConstraint in the request I added it after checking documentation. I really wonder if something is wrong with how I am setting it
My client code is
$options = array( 'credentials' => array( 'key' => AWS_KEY, 'secret' => AWS_SECRET, ), 'signature' => 'v4', 'region' => 'eu-west-2' ); // Instantiate the S3 client with your AWS credentials return S3Client::factory($options);
Relevant content
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 2 years ago
The same error message returns whether or not the bucket exists. Everything I see suggests this error is a result of LocationConstraint not being correct. However I have sent it in the HTTP request as seen above.
The errors when the bucket exist are
[reason] => The requested bucket name is not available. The bucket namespace is shared by all users of the system. Please select a different name and try again. [class] => BucketAlreadyExistsException