aws --version
To show account, ARN and UserID for the AWS CLI connection...
aws sts get-caller-identity
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
unzip awscliv2.zip
sudo ./aws/install
rm -rf aws
rm -f awscliv2.zip
sudo apt install awscli
Download the install package and run it
https://stackoverflow.com/questions/32946050/ssl-certificate-verify-failed-in-aws-clicurl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
unzip awscliv2.zip
BIN_DIR=$(which aws | awk -F/aws '{ print $1 }')
INSTALL_DIR=$(ls -l $(which aws) | awk -F/v2 '{ print $1 }' | awk '{ print $11 }')
sudo ./aws/install --bin-dir ${BIN_DIR} --install-dir ${INSTALL_DIR} --update
~/.aws/credentials
(C:\Users\USERNAME\.aws\credentials
on Windows). For obvious reasons you should not configure AWS CLI access using your credentials from a shared account.aws configure
AWS Access Key ID [None]: XXXXXXXXXX
AWS Secret Access Key [None]: XXXXXXXXXXXXXXXXXXXXXXX
Default region name [None]: eu-west-2
Default output format [None]: table
Default output format can be:
If you need AWS CLI access to multiple AWS accounts then consider using a named Profile...
aws configure --profile profilename
--profile profilename
to all aws commands you issue (where you can't use the default profile).For one-off access to another AWS account (where you don't need the credentials permanently stored) you can set environment variables...
export AWS_ACCESS_KEY_ID=accesskey
export AWS_SECRET_ACCESS_KEY=secretaccesskey
export AWS_DEFAULT_REGION=region
aws ec2 help
Several other pages in this documentation include examples of aws cli usage..
If installed using the curl/unzip method...
INSTALL_DIR=$(ls -l $(which aws) | awk -F/v2 '{ print $1 }' | awk '{ print $11 }')
echo ${INSTALL_DIR}
sudo rm $(which aws)
sudo rm $(which aws_completer)
rm -rf ${INSTALL_DIR}
If you installed with apt, use...
sudo apt remove awscli