Search code examples
amazon-web-servicesamazon-s3kuberneteskops

aws s3api create-bucket —bucket make exception


I am trying to create an S3 bucket using

aws s3api create-bucket —bucket kubernetes-aws-wthamira-io

It gives 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.

I set the region using aws configure to eu-west-1

Default region name [eu-west-1]: 

but it gives the same error. How do I solve this?

I use osx terminal to connect aws


Solution

  • try this:

    aws s3api create-bucket --bucket kubernetes-aws-wthamira-io --create-bucket-configuration LocationConstraint=eu-west-1
    

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

    https://docs.aws.amazon.com/cli/latest/reference/s3api/create-bucket.html