5

Using the aws api I can create a bucket in us-east-1 but not other regions else, why is this ?

$ aws s3api create-bucket --bucket snap2web-12 --region us-east-1
{
    "Location": "/snap2web-12"
}
19:21:27 durrantm u2018 /home/durrantm/Dropbox/_/Michael/cli_scripts 
$ aws s3api create-bucket --bucket snap2web-13 --region us-east-2

An error occurred (IllegalLocationConstraintException) when calling the CreateBucket operation: The unspecified location constraint is incompatible for the region specific endpoint this request was sent to.
19:21:44 durrantm u2018 /home/durrantm/Dropbox/_/Michael/cli_scripts 
$ aws s3api create-bucket --bucket snap2web-14 --region us-west-1

An error occurred (IllegalLocationConstraintException) when calling the CreateBucket operation: The unspecified location constraint is incompatible for the region specific endpoint this request was sent to.
19:23:19 durrantm u2018 /home/durrantm/Dropbox/_/Michael/cli_scripts 
$
Michael Durrant
  • 93,410
  • 97
  • 333
  • 497
  • 1
    Possible duplicate of [aws s3api create-bucket —bucket make exception](https://stackoverflow.com/questions/49174673/aws-s3api-create-bucket-bucket-make-exception) – Asdfg Oct 07 '19 at 18:37

2 Answers2

21

Two possible fixes:

Use the s3 command:

aws s3 mb s3://snap2web-13 --region us-east-2

or, according to the s3api examples (emphasis mine):

Regions outside of us-east-1 require the appropriate LocationConstraint to be specified in order to create the bucket in the desired region:

aws s3api create-bucket --bucket snap2web-13 --region us-east-2 --create-bucket-configuration LocationConstraint=us-east-2
stdunbar
  • 16,263
  • 11
  • 31
  • 53
0

This error is confusing, but it is actually happening because the bucket name that you specified is not unique. Bucket names must be globally unique across AWS. Try using a different bucket name which is unlikely to exist. If the error persists, than it is something else.

Ahsin Shabbir
  • 137
  • 1
  • 4