-
Notifications
You must be signed in to change notification settings - Fork 0
/
aws_cli_install_update_linux.sh
executable file
·42 lines (32 loc) · 1.5 KB
/
aws_cli_install_update_linux.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/usr/bin/env bash
# Title : aws_cli_install_update-linux.sh
# Date : 20221109
# Author : "Jorge Buenabad-Chavez" <[email protected]>
# Version : 1.0
# Description : installs or updates the AWS CLI and AWS completer locally (no need for sudo use)
# Options : [-l][-u][-v] -- description below
#-------------------------------------
# helper functions
source colour_utils_functions.sh # to add colour to some messages
message "\n$(colour lb $(basename $0)) installs or updates the AWS CLI and the AWS completer locally.\n"
read -n 1 -p "Do you want to continue (y/n)?: " option
if [ "$option" != "n" -a "$option" != "N" -a "$option" != "y" -a "$option" != "Y" ]; then
message "\nWrong option $option. Script cancelled." $logfile
exit 1;
elif [ "$option" == "n" -o "$option" == "N" ]; then
message "\nScript cancelled ($option)." $logfile
exit 1;
fi
message "\nInstalling/updating `colour lb aws` (CLI):\n"
cd ### do it in home directory
mkdir ___tmpaws
cd ___tmpaws
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
unzip awscliv2.zip ### creates directory aws in current directory
./aws/install --bin-dir $HOME/.local/bincsaws --install-dir $HOME/.local/bincsaws/aws-cli2 --update
echo "complete -C $HOME/.local/bincsaws/aws_completer aws" >> ~/.bashrc
message "\nCleaning: deleting temporary download directory."
cd ### back to home directory to delete download directory
rm -fr ___tmpaws
message "\nInstalled version of aws:\n"
aws --version