Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

aws s3api create-bucket throws error for us-east-2 #2603

Closed
mickengland opened this issue May 12, 2017 · 15 comments
Closed

aws s3api create-bucket throws error for us-east-2 #2603

mickengland opened this issue May 12, 2017 · 15 comments

Comments

@mickengland
Copy link

@mickengland mickengland commented May 12, 2017

aws s3api create-bucket --bucket dev-xxxx-com-state --region us-east-2

A client error (IllegalLocationConstraintException) occurred when calling the CreateBucket operation: The unspecified location constraint is incompatible for the region specific endpoint this request was sent to.

Works fine with us-east-1.

aws --version
aws-cli/1.7.45 Python/2.7.10 Darwin/16.5.0

@JordonPhillips

This comment has been minimized.

Copy link
Member

@JordonPhillips JordonPhillips commented May 12, 2017

You need to specify the location constraint for every region except us-east-1. See the docs for examples.

Alternatively, you can use mb which will handle that for you.

@rramani7

This comment has been minimized.

Copy link

@rramani7 rramani7 commented Oct 5, 2017

Even though I used LocationConstraint but ended up getting exceptions , checking details of parameter suggest we have finite list for location. I can use AWS web console to create bucket with region as us-east-2 but can't create bucket through awscli create-bucket even after using locationconstraint with region as us-east-2.

{
"LocationConstraint": "EU"|"eu-west-1"|"us-west-1"|"us-west-2"|"ap-south-1"|"ap-southeast-1"|"ap-southeast-2"|"ap-northeast-1"|"sa-east-1"|"cn-north-1"|"eu-central-1"
}

mb seems to be alternate method and going to try that but awscli create-bucket should fix this inconsistency.

@n3ph

This comment has been minimized.

Copy link

@n3ph n3ph commented Nov 5, 2017

Bump.

Facing same problem with duplicity / boto here... (eu-central-1)
On Bucket creation attempt I get:

<Error><Code>IllegalLocationConstraintException</Code><Message>The EU location constraint is incompatible for the region specific endpoint this request was sent to.</Message><RequestId>237A164CEBB07087</RequestId><HostId>oEDaB4OT/MlUGIJ0j1GJH7ezXqldUZa2sFKRPz3iHqAZsnpOyKiRGDV69hP/FTXK1j90ogcJB/Y=</HostId></Error>

If I create the Bucket manually everything is working fine...

Please have a look at your log files...

@adv4000

This comment has been minimized.

Copy link

@adv4000 adv4000 commented Dec 5, 2017

I fixed it in Boto3:

os.environ['AWS_DEFAULT_REGION'] = 'eu-west-2'
myS3 = boto3.resource('s3')
results = myS3.create_bucket(
                             Bucket='zxvxdvx.gsdrgerrrczxczxcgggzxczxczxc',
                             CreateBucketConfiguration={'LocationConstraint': AWS_DEFAULT_REGION}
                            )
@shahzeb1

This comment has been minimized.

Copy link

@shahzeb1 shahzeb1 commented Sep 18, 2018

For those of you looking to create a bucket via the CLI, run this:

aws s3api create-bucket --bucket my-bucket-name --region us-west-2 --create-bucket-configuration LocationConstraint=us-west-2
@thetomasz

This comment has been minimized.

Copy link

@thetomasz thetomasz commented Oct 9, 2018

Posting this here for posterity. Bucket names are GLOBALLY unique! AWS CLI will give you the IllegalLocationConstraintException if you collide with an already existing bucket and you've specified a region different than the region of the already existing bucket. If you happen to guess the correct region of the existing bucket it will give you the BucketAlreadyExists exception.

@jezen

This comment has been minimized.

Copy link

@jezen jezen commented Oct 10, 2018

@thetomasz I can't believe my luck that you posted this 21 hours before I had exactly the same issue. Thank you so much; this was exactly my problem.

@Arnold1

This comment has been minimized.

Copy link

@Arnold1 Arnold1 commented Oct 12, 2018

the following doesnt work for me:
aws s3api create-bucket --bucket avengers-docker-eb --region us-east-1 --create-bucket-configuration LocationConstraint=us-east-1

error:
An error occurred (IllegalLocationConstraintException) when calling the CreateBucket operation: The us-east-1 location constraint is incompatible for the region specific endpoint this request was sent to.

@bingtimren

This comment has been minimized.

Copy link

@bingtimren bingtimren commented Jan 3, 2019

@thetomasz thank you so much for your post! I wish I had first seen your post before finally figured this out myself. The message is truly confusing, even misleading.

To find out if a name is already taken and figure out which region, if it's indeed taken, the bucket is located in, look at the DNS record of the name "your-bucket-name.s3.amazonaws.com". For example:

$ dig test8765.s3.amazonaws.com

; <<>> DiG 9.11.3-1ubuntu1.3-Ubuntu <<>> test8765.s3.amazonaws.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 39766
;; flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 65494
;; QUESTION SECTION:
;test8765.s3.amazonaws.com.	IN	A

;; ANSWER SECTION:
test8765.s3.amazonaws.com. 2016	IN	CNAME	s3-us-west-2-w.amazonaws.com.
s3-us-west-2-w.amazonaws.com. 5	IN	A	52.218.216.10

;; Query time: 16 msec
;; SERVER: 127.0.0.53#53(127.0.0.53)
;; WHEN: Thu Jan 03 15:16:11 AEDT 2019
;; MSG SIZE  rcvd: 99
@JosiahEarl

This comment has been minimized.

Copy link

@JosiahEarl JosiahEarl commented Jan 4, 2019

Well this explains why my bucket name of "testbucket" wouldn't go through ;) Thanks guys.

@Schmidtbit

This comment has been minimized.

Copy link

@Schmidtbit Schmidtbit commented Jan 10, 2019

I had the same issue. Using aws s3 mb s3://<bucket-name> --region us-east-2 worked for me.

@dlandi

This comment has been minimized.

Copy link

@dlandi dlandi commented May 24, 2019

I just encountered this bug, myself. Come on AWS. Fix it. If the error is a global naming collision, then say so.

@venu6644

This comment has been minimized.

Copy link

@venu6644 venu6644 commented Aug 27, 2019

I get this error when I do Put Bucket encryption in my lambda script. Can someone help

An error occurred (IllegalLocationConstraintException) when calling the PutBucketEncryption operation: The ap-east-1 location constraint is incompatible for the region specific endpoint this request was sent to.: ClientError

@dapseen

This comment has been minimized.

Copy link

@dapseen dapseen commented Oct 14, 2019

For those of you looking to create a bucket via the CLI, run this:

aws s3api create-bucket --bucket my-bucket-name --region us-west-2 --create-bucket-configuration LocationConstraint=us-west-2

worked for me

@torressam333

This comment has been minimized.

Copy link

@torressam333 torressam333 commented Oct 29, 2019

For everyone trying to create the bucket in us-east-1 just change the --region us-east-2 and it created perfectly and was visible in my aws console.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
You can’t perform that action at this time.