Wednesday, March 3, 2021

S3 CreateBucket Error: unspecified location constraint is incompatible for the region specific endpoint

If you ever encounterd below error while creating bucket?
 

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.

 

I got this error when trying to run this command in the AWS CLI and the region specifiied is us-east-2

 

aws s3api create-bucket --bucket yourbucketname --region us-east-2
 
Solution:
 
You need to specify the location constaint for every region except us-east-1. so I have tried the below command and it worked. Here I specified the location constraint.
 
aws s3api create-bucket --bucket yourbucketname --region us-east-2 --create-bucket-configuration LocationConstraint=us-east-2
 
This worked!

No comments:

Post a Comment