
aws updateコマンドでmacOSとCloudShell環境をアップデートして違いを見てみた
こんにちは、臼田です。
みなさん、AWS CLI使ってますか?(挨拶
先日AWS CLIを使ってaws updateコマンドを使ってみたのですが、その時は実際にアップデートまでしていませんでした。
しばらく時間が経って、「そろそろできるか?」と思って実際のアップデートの動きを試したところ、気になることがあったので追加で少し調べてみました。
macOSでアップデートしてみた
こんな感じになりました。AWS CLI 2.38.5から2.39.3のアップデートです。
% aws --version
aws-cli/2.38.5 Python/3.14.8 Darwin/24.6.0 script-exe/arm64
% aws update
Updating AWS CLI (source: script-exe)
Downloading https://awscli.amazonaws.com/v2/install.sh
Downloading https://awscli.amazonaws.com/v2/install.sh.sig
Install script signature verified.
Running install script...
Resolving user-local install paths:
HOME=/Users/your-name
XDG_DATA_HOME=/Users/your-name/.local/share
XDG_BIN_HOME=/Users/your-name/.local/bin
Installing AWS CLI 2.38.5 → 2.39.3
Downloading AWS CLI installer from https://awscli.amazonaws.com/AWSCLIV2-2.39.3.pkg?src=update-exe
############################################################################################# 100.0%
PKG code signature verified (team 94KV3E626L).
installer: Package name is AWS Command Line Interface
installer: choices changes file '/var/folders/xx/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/T/tmp.XXXXXXXXXX/choices.xml' applied
installer: Upgrading at base path /Users/your-name
installer: The upgrade was successful.
AWS CLI 2.39.3 installed to /Users/your-name/.local/share/aws-cli
Ensure /Users/your-name/.local/bin is on your PATH. When multiple installs exist, PATH order determines which 'aws' runs.
Tip: run 'aws configure agent-toolkit' to set up AWS skills and the AWS MCP server for your AI coding agent(s).
インストールした結果がこうなりました。
% aws --version
aws-cli/2.39.3 Python/3.14.8 Darwin/24.6.0 update-exe/arm64
おーちゃんと上がっている!
と、ちょっとまってください。バージョン以外にも何か変わっていますね?
% aws --version
aws-cli/2.38.5 Python/3.14.8 Darwin/24.6.0 script-exe/arm64
% aws --version
aws-cli/2.39.3 Python/3.14.8 Darwin/24.6.0 update-exe/arm64 # <--このへん
分かりますか?アップデート前はscript-exe/arm64となっていたところがupdate-exe/arm64になってます!
というわけで、ここの部分をもう少し調べてみました。
aws --versionの出力の意味
aws --versionを実行した時に表示される内容について確認しました。
aws --version の出力を組み立てているのは、awscli/clidriver.pyのCLIDriver._cli_version()です。こんな感じになっています。
- CLI名/バージョン:
aws-cli/2.39.3 - Pythonバージョン:
Python/3.14.8 - OS名/リリース:
Darwin/24.6.0 - 実行環境: 出力なし
- インストール方法:
update-exe - CPUアーキテクチャ:
arm64 - Linuxディストリビューション: 出力なし
インストール方法としてscript-exeやupdate-exeが表示されていたってことですね。そしてaws updateの場合にはこれが既存に上書きされるような動作になるということです。
では他にはどんなインストール方法があるのでしょうか?
インストール方法の値を決めているのは、awscli/clidriver.py: get_distribution_source() です。
awscli/data/install.json → awscli/data/metadata.json の順にファイルを読み、distribution_source の値を返しています。どちらにも値がなければ other になります。
コードとドキュメントから確認できた値は次のとおりです。
exe: 公式インストーラー(pkg/zip/msi)script-exe: インストールスクリプトupdate-exe:aws updatesource: リポジトリに入っているmetadata.jsonの既定値source-sandbox: ソースからビルド(--with-install-type=system-sandbox)source-exe: ソースからビルド(--with-install-type=portable-exe)other:distribution_sourceがない場合
このうち aws update に対応しているのは、update.py: _SUPPORTED_SOURCES に書かれている exe、script-exe、update-exeの3つだけです。
_SUPPORTED_SOURCES = ('exe', 'script-exe', 'update-exe')
実はインストール方法によってはaws updateできないってことなんですね。なるほど。
これは現状英語のユーザーガイドにも以下のように書かれていました。
Starting with version 2.36.0, if you installed the AWS CLI using the install script or an official installer (the Linux command line installer, the macOS PKG installer, or the Windows MSI installer), you can update to the latest version by running the following command.
バージョン 2.36.0 以降では、インストールスクリプトまたは公式インストーラー(Linux のコマンドラインインストーラー、macOS の PKG インストーラー、Windows の MSI インストーラー)で AWS CLI をインストールした場合、次のコマンドを実行して最新バージョンに更新できます。
AWS CloudShellでもやってみた
Linux環境でもぼちぼち出力も違いそうですし、AWS CloudShell環境でも動作を見てみましょう。
普段使わないリージョンにいって、クリーンな環境でAWS CLIを実行してみます。まずバージョン確認。
~ $ aws --version
aws-cli/2.38.6 Python/3.14.8 Linux/6.1.188-233.393.amzn2023.x86_64 exec-env/CloudShell exe/x86_64.amzn.2023
出力がmacOSでは出なかった環境変数exec-env/CloudShellとLinuxディスティネーション.amzn.2023が出力されていますね。
ではこちらも上げてみましょう。
~ $ aws update
Updating AWS CLI (source: exe)
aws: [ERROR]: Updating a system-wide AWS CLI installation requires root.
どうやらsudoが必要なようです。
~ $ sudo aws update
Updating AWS CLI (source: exe)
Downloading https://awscli.amazonaws.com/v2/install.sh
Downloading https://awscli.amazonaws.com/v2/install.sh.sig
Install script signature verified.
Running install script...
Installing AWS CLI 2.38.6 → 2.39.3
Downloading AWS CLI installer from https://awscli.amazonaws.com/awscli-exe-linux-x86_64-2.39.3.zip?src=update-exe
################################################################################################################################################################################################# 100.0%
Downloading AWS CLI signature from https://awscli.amazonaws.com/awscli-exe-linux-x86_64-2.39.3.zip.sig?src=update-exe
################################################################################################################################################################################################# 100.0%
GPG signature verified.
You can now run: /usr/local/bin/aws --version
AWS CLI 2.39.3 installed to /usr/local/aws-cli
Ensure /usr/local/bin is on your PATH. When multiple installs exist, PATH order determines which 'aws' runs.
Tip: run 'aws configure agent-toolkit' to set up AWS skills and the AWS MCP server for your AI coding agent(s).
上がりました。確認します。
~ $ aws --version
aws-cli/2.39.3 Python/3.14.8 Linux/6.1.188-233.393.amzn2023.x86_64 exec-env/CloudShell update-exe/x86_64.amzn.2023
ちゃんと上がりました。そして、インストール方法は同じくupdate-exeになっていますね。
まとめ
aws updateコマンドを実際に試しました。実はaws --versionでインストール方法が出るようになっていて、アップデートしたらそれが変わるというのは地味ですが気になるポイントですね。
AWS CloudShellでもアップデートしやすくなりましたし、便利に活用していきましょう!









