This post describes how to install AWS CLI on linux step-by-step. AWS CLI is a command line interface which allows us to interact with our AWS account. Developer and sysadmin use aws cli to perform day to day activities and automation.
Prerequisites
- Pre-Installed Linux System
- Sudo User with admin rights
- Internet Connectivity
Without any further delay, let’s jump into AWS Cli installations steps.
1) Download Installation File
Open the terminal and run following curl command to download aws cli installation file,
$ curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
Above command will download file as ‘awscliv2.zip’ in current working directory.
Execute below ls command to verify downloaded file,
$ ls -l awscliv2.zip -rw-rw-r-- 1 linuxtechi linuxtechi 47244662 Oct 20 10:53 awscliv2.zip $
2) Unzip Downloaded Installation File
Run beneath unzip command to unzip the installer.
$ unzip awscliv2.zip
It will create aws folder in present working directory and unzip all required files into it.
$ ls -ld aws drwxr-xr-x 3 linuxtechi linuxtechi 4096 Oct 19 17:18 aws $
3) Install AWS Cli on Linux Using Install Script
To install aws cli, run following install script,
$ sudo ./aws/install
Script will install all files under /usr/local/aws-cli and will create symbolic link in /usr/local/bin.
4) Verify AWS CLI version
To verify the aws cli version, run
$ aws --version aws-cli/2.8.4 Python/3.9.11 Linux/5.15.0-48-generic exe/x86_64.ubuntu.22 prompt/off $
5) Configure AWS CLI
To verify the AWS Cli installation, let’s configure aws cli.
Login to your AWS management console and retrieve AWS access key id and secret access key.
In case it is not created yet then create access key ID and secret access key. Copy these keys somewhere safe.
Now head back to Linux terminal, run following aws command,
$ aws configure AWS Access Key ID [None]: xxxxxxxxxxxxxxxxxxx AWS Secret Access Key [None]: xxxxxxxxxxxxxxxxxxx Default region name [None]: us-west-2 Default output format [None]: json $
Above credentials will be saved in following file,
$ cat ~/.aws/credentials
Output of above commands,
Run aws command to list s3 bucket and vpc of your account.
$ aws s3 ls $ aws ec2 describe-vpcs
Output,
Output above confirms that aws cli has been configured successfully.
That’s all from this post, feel free to post your queries and feedback in below comments sections.