Aws-cli: [1.2.10][s3api] IllegalLocationConstraintException when using dots in bucket name

Created on 11 Jan 2014  路  2Comments  路  Source: aws/aws-cli

When running:
aws s3api create-bucket --region eu-west-1 --profile xxx --bucket com-a

everything works, however when runing:
aws s3api create-bucket --region eu-west-1 --profile xxx --bucket com.a

I get:
A client error (IllegalLocationConstraintException) occurred when calling the CreateBucket operation: The unspecified location constraint is incompatible for the region specific endpoint this request was sent to.

But through Console it is possible to use dots.

documentation guidance

Most helpful comment

If you want to create a bucket in eu-west-1 with the low level S3 API you have to use the --create-bucket-configuration option

aws s3api create-bucket --bucket foo.bar --create-bucket-configuration LocationConstraint=eu-west-1

All 2 comments

If you want to create a bucket in eu-west-1 with the low level S3 API you have to use the --create-bucket-configuration option

aws s3api create-bucket --bucket foo.bar --create-bucket-configuration LocationConstraint=eu-west-1

I think we bumped into this issue again, using boto3 (1.4.3)

To reproduce in a python repl:

import boto3
s3 = boto3.resource('s3')
b = s3.Bucket('test-with-d.0.t.s')

b.create() fails with: "botocore.exceptions.ClientError: 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."

b.create(CreateBucketConfiguration={ 'LocationConstraint': 'us-west-2' }) works -- the json that gets sent along for the API call has 'Location': 'http://test-with-d.0.t.s.s3.amazonaws.com/' in it.

Was this page helpful?
0 / 5 - 0 ratings