Summary
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’
Solution
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
Download the awscli bundle installer file
curl "https://s3.amazonaws.com/aws-cli/awscli-bundle.zip" -o "awscli-bundle.zip"
Unzip the package
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.
Install aws cli.
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.
Login with the user id and run the following command
curl "https://s3.amazonaws.com/aws-cli/awscli-bundle.zip" -o "awscli-bundle.zip"
unzip awscli-bundle.zip
./awscli-bundle/install -b ~/bin/aws
Then run this command.
export PATH=~/bin:$PATH
You can add or update above PATH variable in .bashrc for applying it permanently.