scireum / s3ninja

S3 ninja emulates the Amazon S3 API for developement and test purposes
MIT License
493 stars 91 forks source link

How to deal with Region Endpoints #155

Closed stewartm83 closed 4 years ago

stewartm83 commented 4 years ago

I have setup docker container with all the settings and I have the following profile on my Dev Machine

[profile ninja]
aws_access_key_id = AKIAIOSFODNN7EXAMPLE
aws_secret_access_key = wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
region = http://localhost:9444/s3

When I run aws s3 ls --profile ninja

I am getting an error saying Could not connect to the endpoint URL: "http://s3.localhost:9444/s3.amazonaws.com"

jakobvogel commented 4 years ago

Hello @stewartm83 👋 Frankly, I think your setup is wrong. If you have a look here, you will see that the general format of Amazon's S3 URLs is

s3.<region>.amazonaws.com

where <region> is something like us-west-2. Apparently, your tool modifies the local URL erroneously given as region to pseudo-region localhost:9444/s3 and inserts that into the pattern quoted above, yielding the strange URL printed in the error message. Unfortunately, I can not provide assistance to fix the setup as we use different client software. Please consult the documentation, or use a different tool such as s3cmd. Also, please note that when running within a docker container, the publicly exposed port will most likely differ from the default port. Invoke docker ps to make sure that you use the correct port number. Finally, please enable path-style access for more reliable encoding of bucket names. I hope that you will be able to fix the setup with these hints. Cheers!

jakobvogel commented 4 years ago

Closing this. No code changes necessary.