s3cmd icon indicating copy to clipboard operation
s3cmd copied to clipboard

Misleading error message "Configuration file not available" when IAM role not found

Open mindaugasrukas opened this issue 8 years ago • 4 comments

I receiving a misleading error message when passing an empty access_key and secret_key in config file and there is no IAM role attached to ec2 instance. https://github.com/s3tools/s3cmd/blob/db37cf75ff372e81f4c8a7d42418135de37fdb2f/S3/Config.py#L214 https://github.com/s3tools/s3cmd/blob/db37cf75ff372e81f4c8a7d42418135de37fdb2f/s3cmd#L2783

It would be nice to receive more meaningful error message: "IAM security-credentials not found"

mindaugasrukas avatar Feb 15 '17 09:02 mindaugasrukas

Thanks for your report. You are right, that should be improved.

fviard avatar Mar 14 '17 13:03 fviard

FYI, this StackOverflow comment points to the part of the code that results in this message: https://stackoverflow.com/a/45789911/443201

If I find the time, I'll work on a fix and send a pull request.

brunogirin avatar Aug 22 '17 09:08 brunogirin

I just need a bit more time to fix that, but i have a rework of this section of code in the pipe. It is messy and something is bad with the current code for iam. (requesting a refresh at each request).

fviard avatar Aug 22 '17 11:08 fviard

it would be nice to have the actual IAM error from AWS when this happens. we are authenticating using metadata server (hence, not explicitly passing credentials via env vars or on cmd line) and sometimes we get failures but the actual error message is masked by this incorrect one about config file (that we do not use)

rick-maria avatar Mar 17 '23 10:03 rick-maria