DEV Community

Abhishek Anand Amralkar
Abhishek Anand Amralkar

Posted on

Unspecified Location Constraint

I was creating an AWS S3 bucket using AWS CLI, but I was getting below error while creating bucket

Problem:

Command:-
aws s3api create-bucket --bucket abhishek-qa-state-store --region us-west-2                                                                                                                                    
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.

Solution:

For any other region than us-east-1 in AWS, we need to define the LocationConstraint. Below is the command which will create a bucket for you in any other region apart from us-east-1

Command:-
aws s3api create-bucket --bucket abhishek-qa-state-store --region us-west-2 --create-bucket-configuration LocationConstraint=us-west-2                                                                         
Output:-
{
    "Location": "http://abhishek-qa-state-store.s3.amazonaws.com/"
}

More info available here

AWS S3 Location Constraint

Top comments (0)