Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

aws cli returns python objects instead of regular output

I just installed aws cli on Ubuntu following the oficial installation guide on an azure VM.

When I run any command from the command line the results are python objects and not a text or regular output

$ aws s3 ls

<botocore.awsrequest.AWSRequest object at 0x7f412f3573a0>

I searched everywhere but I cant find any hint. I already reinstalled aws and also tried using the output flag but nothing changes.

Any suggestions?

like image 735
Iván Avatar asked Jul 27 '26 05:07

Iván


1 Answers

This took me a while to figure out as well. For some reason this only affected our CICD jobs, but using the same exact container image and env vars locally worked fine.

Turns out, the issue stems from not providing a region.

You can fix this by specifying the region explicitly in the command:

aws s3 ls --region us-west-2

Or by providing the region with the available AWS env vars:

export AWS_REGION="us-west-2"
# or
export AWS_DEFAULT_REGION="us-west-2"

Some related sources that helped me figure this out:

  • https://github.com/jwalton/gh-ecr-login/issues/3
  • aws s3 ls gives error botocore.utils.BadIMDSRequestError: <botocore.awsrequest.AWSRequest object at 0x7f3f6cb44d00>
like image 87
tstraley Avatar answered Jul 29 '26 15:07

tstraley



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!