dvassallo / s3-benchmark

Measure Amazon S3's performance from any location.
MIT License
821 stars 133 forks source link

InvalidLocationConstraint: The specified location-constraint is not valid #8

Closed danielhaviv closed 5 years ago

danielhaviv commented 5 years ago

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
mattisdada commented 5 years ago

I'm also receiving the exact same issue, I suspect it has to do with the server being in us-east-1

dvassallo commented 5 years ago

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.

dvassallo commented 5 years ago

You can also work around this by creating the S3 bucket manually.

darpandodiya commented 5 years ago

Is there any way to pass bucket name as parameter if we create S3 bucket manually?

dvassallo commented 5 years ago

Yep, just pass -bucket-name <your-bucket>.

darpandodiya commented 5 years ago

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: https://github.com/boto/boto3/issues/125

Will try to submit pull request if I manage to figure out and fix the issue.

dvassallo commented 5 years ago

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.