Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

'AWSHTTPSConnection' object has no attribute 'ssl_context'

Tags:

aws-cli

Not working
    root@49161b16e779:/# aws --version
    aws-cli/1.11.121 Python/3.5.2 Linux/4.10.0-32-generic botocore/1.5.84
    root@49161b16e779:/# aws s3 ls s3://my.bucket.path
    'AWSHTTPSConnection' object has no attribute 'ssl_context'

Working fine
    tada@tada-VirtualBox:~$ aws --version
    aws-cli/1.11.13 Python/3.5.2 Linux/4.10.0-32-generic botocore/1.4.70

The above is a problem I'm getting lately, since somewhere between July 25 and Aug 3, 2017.

Docker is node:6.9.2. Also tried the 'ubuntu' image, same error.

I can't seem to find the error source. Anyone know how to solve it? Thanks.

like image 650
Barvaz Avatar asked Aug 22 '17 14:08

Barvaz


1 Answers

This is caused by a bug in AWS CLI, noted at https://github.com/boto/botocore/issues/1258#issuecomment-321787841, that mades it incompatible with newer versions of Requests. If you install awscli with Pip, you won't see the bug, because the version that you get from Pip has an old, compatible version of Requests baked into it. But if you've installed AWS CLI with Apt (or perhaps some other package managers), you'll have got a version of AWS CLI that uses the system's Requests module, exposing you to this bug.

To fix, either:

  1. Remove whatever version of the AWS CLI you've got installed and reinstall it with Pip. This probably means running apt remove awscli && pip install awscli.

... OR, if you can't do that for some reason:

  1. Downgrade Requests to version 2.12, which according to https://github.com/boto/botocore/issues/1258#issuecomment-331746809 is compatible with the old versions of AWS CLI, by running pip uninstall requests && pip install requests==2.12 or pip3 uninstall requests && pip3 install requests==2.12.

I believe this issue is fixed as of botocore v1.11.0, so eventually, once the version of awscli in Apt's repositories uses a botocore version >= v1.11.0, this bug should go away.

like image 155
Mark Amery Avatar answered Nov 05 '22 22:11

Mark Amery