How Do You Troubleshoot the AWS CLI Error Regarding IllegalLocationConstraintException?

Problem scenario
You run a command like this:

aws s3api create-bucket --bucket coolnameforbucket

But you get this error:
"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."

How do you create a bucket with the aws s3api command?

Possible Solution #1
Run a command such as this, but replace "us-west-9" with the region of your choice:

aws s3api create-bucket --bucket my333zzz-bucketz --region us-west-9 --create-bucket-configuration LocationConstraint=us-west-9

Possible Solution #2
Use aws configure and accept the first two defaults. Then change the region to "us-east-1" or the region of your choice.

Possible Solution #3
Do not use the AWS CLI. Use the web console.

Leave a comment

Your email address will not be published. Required fields are marked *