AWS Command Line Interface (AWS CLI) is available in two versions. To ensure a smooth experience, this guide covers the installation of AWS CLI v2 for Windows and Ubuntu, as it is simpler, more convenient, and feature-complete compared to v1.
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
unzip awscliv2.zip
sudo ./aws/install
msiexec.exe /i https://awscli.amazonaws.com/AWSCLIV2.msi
sudo ln -s /folder/installed/aws-cli/aws /usr/local/bin/aws
sudo ln -s /folder/installed/aws-cli/aws_completer /usr/local/bin/aws_completer
aws --version
Use the aws configure
command to set up the AWS CLI. This is the fastest way to configure it. You will be prompted for the following details:
aws configure
AWS Access Key ID [None]: *AKIAIOSFODNN7EXAMPLE*
AWS Secret Access Key [None]: *wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY*
Default region name [None]: *ap-southeast-1*
Default output format [None]: *json*
The AWS CLI stores this information in a profile named default in the credentials file. This profile is used when no specific profile is specified.
aws configure --profile devops
The access key (Access Key ID and Secret Access Key) is used to authenticate requests to AWS.
cd ~/.aws/
ls
cat config
aws configure get region --profile devops
aws configure list
aws configure list-profiles
You can add or edit profiles directly by editing the config and credentials files using a text editor.