Nikul
Nikul

Reputation: 495

Error: "[BucketAlreadyOwnedByYou] Your previous request to create the named bucket succeeded and you already own it" in amazon server

I checked the my server log, there are so many errors like:

S3::putBucket(******): [BucketAlreadyOwnedByYou] Your previous request to create the named bucket succeeded and you already own it. in /var/www/html/****/public_html/*****/common/config/S3.php on line 188

I googled it, but I didn't get any proper help, can anyone please tell me what is causing this error? How can I solve this issue?

Upvotes: 14

Views: 20883

Answers (4)

fmk
fmk

Reputation: 39

All this is related with regions. For example, if your script set region to us-east-1, but using Amazon new interface to create a new bucket you chose any other, when run your script you will have that error. In my case I had to delete the newly created bucket and re-create it. This will take time, because AWS locks bucket name, so just be patient to recreate the folder. Of course there are other ways to do it in code, if you are not in a rush (like me). But trust me, they take time to kill that bucket...

Upvotes: 3

Gui Faccinetto
Gui Faccinetto

Reputation: 11

I got this error due to region discrepancy. When creating the s3Client on a testContainer test's set-up I had 'us-east-1' and later when adding some bucket config with 'CreateBucketConfiguration.builder().locationConstraint()' I passed 'us-east-2' as an accident. That triggered that exception, along the lines of lmk's response.

Upvotes: 1

Andrzej Rehmann
Andrzej Rehmann

Reputation: 13790

http://docs.aws.amazon.com/AmazonS3/latest/API/ErrorResponses.html

BucketAlreadyOwnedByYou

Your previous request to create the named bucket succeeded and you already own it. You get this error in all AWS regions except US East (N. Virginia) region, us-east-1. In us-east-1 region, you will get 200 OK, but it is no-op (if bucket exists it Amazon S3 will not do anything).

409 Conflict (in all regions except US East (N. Virginia) region).

How to ignore it, check if the bucket already exist, if not then create it.

For bash:

BUCKET_NAME=my-bucket-name
aws s3api get-bucket-location --bucket ${BUCKET_NAME} || aws s3 mb s3://${BUCKET_NAME}

Upvotes: 6

Philippe Benedetti
Philippe Benedetti

Reputation: 9

This happens when you ask S3 to create a bucket already created.

Can you give us some details about how you use S3 from EC2? Environment, SDK version, code...

We can't help without details.

Upvotes: -3

Related Questions