AWS CLI v1 (Deprecated)
Note: As of July 15, 2021, AWS have formally ended support for Python 2.7 and recommend upgrading to AWS CLI v2.
If the AWS CLI v1 fails with the below error, it can be due to that fact that the AWS CLI v1 is installed under python 2.7 as opposed to python 3.x:
"TypeError: unsupported operand type(s) for -=: 'Retry' and 'int'"
The reason this error may not happen on each build is due to the fact that this error only occurs when the AWS CLI v1 retries a network connection. So on most builds this code path will never be reached.
If on the Docker Executor, you can change your python version to 3.x.
If on Machine Executor, you can make use of pyenv before installing via pip. Be sure not to call `pip` with `sudo`.
pyenv global 3.7.0 pip install awscli