Skip to content

Instantly share code, notes, and snippets.

@creachadair
Last active March 13, 2026 15:34
Show Gist options
  • Select an option

  • Save creachadair/1954e01d5558880c6ca072b5a23842f1 to your computer and use it in GitHub Desktop.

Select an option

Save creachadair/1954e01d5558880c6ca072b5a23842f1 to your computer and use it in GitHub Desktop.
Update installed version of the AWS CLI on a Linux system
#!/usr/bin/env bash
#
# Update the installed version of the AWS CLI on Linux.
#
set -euo pipefail
: ${TMPDIR:=/tmp}
tmp="$(mktemp -d $TMPDIR/awscli.XXXXXXXXXX)"
trap "rm -fr -- '$tmp'" EXIT
pushd "$tmp"
case "$(uname -s)" in
(Darwin|darwin)
curl -L "https://awscli.amazonaws.com/AWSCLIV2.pkg" -o "awscliv2.pkg"
sudo installer -pkg awscliv2.pkg -target /
;;
(*)
curl -L "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
unzip -qo awscliv2.zip
sudo ./aws/install --update
;;
esac
popd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment