Created
May 12, 2023 15:19
-
-
Save bradthurber/9f8a2809278979241ff84aea8440dfe8 to your computer and use it in GitHub Desktop.
bash script to install/update the AWS SAM CLI on Ubuntu
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash -e | |
# https://docs.aws.amazon.com/cli/latest/userguide/install-cliv2-linux.html#cliv2-linux-install | |
# https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-completion.html | |
echo "make sure OS is up-to-date" | |
sudo apt update && sudo apt upgrade -y | |
sudo apt install unzip -y | |
echo "* Switching to new temporary tmp folder..." | |
pushd "$(mktemp -d)" | |
echo | |
echo "* Downloading the AWS SAM CLI installer for linux" | |
wget https://github.com/aws/aws-sam-cli/releases/latest/download/aws-sam-cli-linux-x86_64.zip -O aws-sam-cli-linux-x86_64.zip | |
echo | |
echo "* Unzipping it..." | |
unzip -q aws-sam-cli-linux-x86_64.zip | |
echo | |
if [ -f /usr/local/aws-sam-cli/current/bin/sam ]; then | |
echo "* Current version:" | |
/usr/local/aws-sam-cli/current/bin/sam --version | |
echo "* Updating..." | |
sudo ./install --update | |
else | |
echo "* Installing..." | |
sudo ./install | |
fi | |
echo | |
echo "* Installed version:" | |
sam --version | |
echo | |
echo "Resuming at original directory" | |
popd |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment