HTTP Client raised and unhandled exception

Recently we encountered the error on our aws cli with following error message. We have updated our systems and seems other things were working fine.

Error:

An HTTP Client raised and unhandled exception: __init__() got an unexpected keyword argument ‘ssl context’

To solve the above problem,we decided to remove the aws cli which we installed with pip command.

We install the aws cli by using the bundled zip file provide by aws itself. Do notice that when we use the awscli bundled file, it has its own pip script inside.

Install AWS CLI by using bundled installer

  1. Download the awscli bundle installer file
  2. curl "https://s3.amazonaws.com/aws-cli/awscli-bundle.zip" -o "awscli-bundle.zip"
    
  3. Unzip the package
  4.  unzip awscli-bundle.zip
    

    You must have unzip package installed in your system. Most of the Linux distros has unzip package name called as unzip itself.

  5. Install aws cli
  6. sudo ./awscli-bundle/install -i /usr/local/aws -b /usr/local/bin/aws
    

Note:You can get more help parametere by using this command. ./awscli-bundle/install -h

Install AWS Cli using bundle installer to user home directory

In case,you want to install the aws cli only to a specific user home dir and make it available to only that user. This method is useful when user do not have sudo privileges too.

  1. Login with the user id. And run following command
  2. curl "https://s3.amazonaws.com/aws-cli/awscli-bundle.zip" -o "awscli-bundle.zip"
    unzip awscli-bundle.zip
    ./awscli-bundle/install -b ~/bin/aws
    
  3. Login with the user id. And run following command
  4. export PATH=~/bin:$PATH
    

You can add or update above PATH variable in .bashrc for applying it permanently.