[Mac] 將 AWS CLI v1 升級成 v2

[Mac] 將 AWS CLI v1 升級成 v2

之前在 Mac 上安裝了 AWS CLI,

最近執行時,發現它說現在有 version 2,建議我們升級:

$ aws

Note: AWS CLI version 2, the latest major version of the AWS CLI, is now stable and recommended for general use. For more information, see the AWS CLI version 2 installation instructions at: https://docs.aws.amazon.com/cli/latest/userguide/install-cliv2.html

usage: aws [options] <command> <subcommand> [<subcommand> ...] [parameters]
To see help text, you can run:

  aws help
  aws <command> help
  aws <command> <subcommand> help
aws: error: the following arguments are required: command

 

查了一下,AWS CLI v2 應該是相容於 v1,

建議我們移除掉舊版的 v1 只用 v2~

先看一下現在的 AWS CLI 版本,是 1.18.185:

$ aws --version
aws-cli/1.18.185 Python/3.9.9 Darwin/20.6.0 botocore/1.19.25

 

在 Mac 移除掉舊版的 AWS CLI 很簡單,刪掉一個目錄和檔案就好了:

sudo rm -rf /usr/local/aws
sudo rm -f /usr/local/bin/aws

 

接下來就可以安裝 AWS CLI v2 了:

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

 

再來看一下現在的版本,已經變成 2.4.7 囉:

$ aws --version
aws-cli/2.4.7 Python/3.8.8 Darwin/20.6.0 exe/x86_64 prompt/off

 

參考資料:Installing or updating the latest version of the AWS CLI

 

(本頁面已被瀏覽過 241 次)

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *

這個網站採用 Akismet 服務減少垃圾留言。進一步了解 Akismet 如何處理網站訪客的留言資料