Search code examples
amazon-web-servicespipaws-cli

change the AWS CLI from 1 to 2


When checking the AWS PATH with which aws when changing the AWS CLI from 1 to 2

/Users/username/.pyenv/shims/aws

I used to install via pyenv, but I want to remove it and install it according to system 2, but even if I try it according to the official doc, it is not changed to system 2. https://docs.aws.amazon.com/cli/latest/userguide/install-cliv2-mac.html

curl "https://awscli.amazonaws.com/AWSCLIV2.pkg" -o "AWSCLIV2.pkg"
sudo installer -pkg AWSCLIV2.pkg -target /

It did not change to the 2 system even if I typed this command.

I've also tried uninstalling the AWS CLI, but it doesn't work. Does anyone know of any way to do this?

thank you


Solution

  • I removed my old aws cli from ~/.pyenv/versions/x.x.x/bin/aws, where x.x.x is the current Python version.

    Get the current version:

    $ pyenv versions
    * 3.7.4 
    

    Remove aws cli from current pyenv bin:

    $ rm -rf ~/.pyenv/versions/3.7.4/bin/aws*
    

    Try again which aws:

    $ which aws 
    /usr/local/bin/aws