AWS CLI is a tool used to access and control multiple AWS services from a command line. It is available for Windows, Linux, Mac, and also as a Docker image.
You can download and install the AWS client, configure it once and use it at any point of time you want to access any AWS service. No configuration or login is necessary for each time you want to access your AWS service. AWSCli V2 is the latest version of the AWS client.
In this tutorial, you’ll download, install AWS CLI on Ubuntu and configure AWS CLI on Ubuntu.
- AWS Account
- Security Credentials(Access key & Secret access Key) for your account.
Step 1 – Installing AWS Cli on Ubuntu
In this step, you’ll install
AWS Cli on Ubuntu. First, you’ll update all the packages installed in your Ubuntu Installation. it can be installed using the
sudo apt update and
sudo apt -y upgrade command as below.
sudo apt update sudo apt -y upgrade
-y flag means that you agree to the terms of all items that are updated. However, you may need to agree to the prompts during the update depending on the version of Linux you use.
Your packages are up-to-date.
Now you’ll install AWS-CLI using the
curl tool is used to copy data from one server to another server.
Execute the below command to copy the AWS client package from the Amazon server to your server.
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
The package is not downloaded to your local server as a zip file.
You need to unzip the file before accessing the files from it. To unzip a zip file,
unzip a package must be installed on your server.
Use the below command to install the
sudo apt install unzip
unzip package is installed. Use the below command to unzip the awscliv2 zip package.
Now it’s unzipped into your current directory.
Execute the install file available in the /aws/ directory to install the AWS client.
AWSCLi V2 is installed in the location /usr/local/aws-cli and a symbolic link is created to
/usr/local/bin. Hence you need not add the installation location to the
Now you’ll check the version of the AWS Client version installed using the below command.
This will display the currently installed version of the AWS Client.
aws-cli/2.1.7 Python/3.7.3 Linux/5.4.0-1029-aws exe/x86_64.ubuntu.20 prompt/off
AWS CLI is installed successfully. Now you’ll start configuring AWS CLI to manage and access your AWS services.
Step 2 – Creating Access Keys in AWS Console
In this step, you’ll configure the AWS CLI using the access key id and the secret access key
Access key ID and secret access key are used to call aws programmatically via AWS-CLI, PowerShell tools, or direct AWS-API calls.
To create an Access key ID and secret access key, head over to the My security credentials options as shown below.
Click the New Access Key option.
You’ll be seeing a message box that has the information about your access key id and the secret access key. You can directly download the access key file to your local computer by Using the Download Key File option. It will be downloaded as a CSV file.
You can also click Show Access key option to display the access key directly in the window. Once shown, you can copy the key information manually and store it in your secure notes.
Either download a file or copy the information to your secure notes. You’ll not be able to view the key information once again. Also creating a key from the root user key is providing unrestricted access to your entire AWS account. Hence be cautious or create a key with the new IAM role.
You have the key information for your AWS account. Now you’ll use this information and configure the AWS CLI.
Step 3 – Configuring AWS CLI on Ubuntu
In this step, you’ll configure the AWS CLI with the Acess Key ID and Secret Access Key which you have generated in step 2.
aws command is used to access the AWS services.
Configure parameter with the AWS command allows you to configure the AWS client to connect to your AWS account.
Use the below command to start the configuration.
Enter. You’ll be asked to enter the AWS Access key id. Enter the value you have copied.
AWS Access Key ID [None]: AKIAXXXXXXXXXXXXXXXXQ
Enter. You’ll be asked to enter the AWS Secret Access key for your Access Key ID. Enter the value you have copied.
AWS Secret Access Key [None]: JNf0pt2XXXXXXXXXXiXXXMXXXouIXXXXCW2u6R
Enter. You’ll be asked to enter the Default region. Enter your desired default region.
Default region name [None]: asia
Enter. You’ll be asked to enter the Default output format. Enter your desired default output format. Here you’ll use text as a default. Other available output formats are JSON, YAML, YAML-stream, table.
Default output format [None]: text
Enter. AWS client configuration is successful. Now you’ll verify if the configuration is correctly done.
Step 4 – Checking AWS Cli Configuration
In this step, you’ll verify if the AWS Client is correctly configured and able to access your AWS account.
For this verification, you’ll use the
iam get-user command. If everything is configured properly, then you’ll be seeing your user information in the output screen.
Use the below command to get the configured user information.
aws iam get-user
You’ll see the information given below. The highlighted word shows the configured user name.
USER arn:aws:iam::322666080840:root 2020-11-01T10:03:04+00:00 2020-12-04T02:37:36+00:00 322666080840
To know more about all the commands available in the AWS client, you can use the below command
To know more about the service-specific commands such as EC2, you can use the below command.
aws ec2 help
You can replace any service name in the highlighted place to know about that specific service help.
You’ve successfully installed, configured, and tested AWSCliV2 on Ubuntu 20.04.
In this tutorial, you’ve learned how to install aws cli on ubuntu, configure AWS CLI on ubuntu, and tested it.
How to install AWS CLI on Linux?
You can use the CURL command to download the AWSCli setup package, unzip the package and install using the command
How to use AWS CLI Linux?
You can use the AWS CLI in Linux using the $ AWS <commandname>. Just ensure AWS CLI is installed and configured before using the AWS command.
How do you check AWS CLI is installed?
You can check if AWS CLI is installed by using the command $
AWS --version . If it is installed, it will display the currently installed version details. If not, you’ll see an error.
What is CLI AWS?
AWS CLI is a client tool used to connect and manage your AWS services from your local computer.