InvalidLocationConstraint: The specified location-constraint is not valid
danielhaviv opened this issue · 7 comments
Trying to run the benchmark tool from an EC2 instance on an existing bucket:
[ec2-user@ip-172-31-2-167 ~]$ ./s3-benchmark -bucket-name dhavivresearch -full -region us-east-1
--- SETUP --------------------------------------------------------------------------------------------------------------------
panic: Filed to create S3 bucket: InvalidLocationConstraint: The specified location-constraint is not valid
status code: 400, request id: 41997BE73BC03A06, host id: ZNEaOvY5TyFs0PR3xh73aUAPVg6y18y9iV/bzJH4TJYiQ8/sKPk+wIqReWkRtpH3/wV+oV53Sns=
goroutine 1 [running]:
main.setup()
/Users/daniel/go/src/github.com/dvassallo/s3-benchmark/main.go:229 +0xa35
main.main()
/Users/daniel/go/src/github.com/dvassallo/s3-benchmark/main.go:113 +0x44
I'm also receiving the exact same issue, I suspect it has to do with the server being in us-east-1
I think the fix is to wrap s3.BucketLocationConstraint(region) with NormalizeBucketLocation. I'll take a look at fixing it some time next week. In the meantime feel free to give that a shot.
You can also work around this by creating the S3 bucket manually.
Is there any way to pass bucket name as parameter if we create S3 bucket manually?
Yep, just pass -bucket-name <your-bucket>
.
Great thanks! I have tried this on us-east-1 region, the InvalidLocationConstraint was still present. I am now going to try this out on us-west-1 to see if that fixes the error. This was helpful to give some background: boto/boto3#125
Will try to submit pull request if I manage to figure out and fix the issue.
I think the fix is to wrap s3.BucketLocationConstraint(region) with NormalizeBucketLocation. I haven't had time to test it though. PR welcome and appreciated if you manage to give it a shot.