aws --versionTo show account, ARN and UserID for the AWS CLI connection...
aws sts get-caller-identitycurl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"unzip awscliv2.zipsudo ./aws/installrm -rf awsrm -f awscliv2.zipsudo apt install awscliDownload 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.zipBIN_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 configureAWS Access Key ID [None]: XXXXXXXXXXAWS Secret Access Key [None]: XXXXXXXXXXXXXXXXXXXXXXXDefault region name [None]: eu-west-2Default output format [None]: tableDefault 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=accesskeyexport AWS_SECRET_ACCESS_KEY=secretaccesskeyexport AWS_DEFAULT_REGION=regionaws ec2 helpSeveral 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