My journey to AWS cloud practitioner – Refreshing my memory with AWS CLI – Part 1

Estimated read time 3 min read

Its been more than 6 years since I did not deep dive into the AWS cloud administration. I guess it is time for me to do it now. I decided to write as I am moving on to the path of being an AWS cloud practitioner. I do remember quite a bunch of stuff though and I notice that there is not a huge change in the user interface of the AWS console.

So, I installed Rocky Linux on a virtual machine as my Administration box. I’ll be playing around from there itself.

Installing and configuring AWS CLI

1. Make sure you are not logged in as root user. Then install the Python3-pip package.

dnf install python3-pip

2. Install the AWS CLI package

pip3 install awscli --upgrade --user

3. Once you get this running, you might want to check the version

aws --version

4. Let’s now configure the AWS CLI using the aws configure command. You will need Access Key ID and Secret Access key which can be found on the Security Credential homepage

First, you have to go to the IAM Management console and under Security Credentials, you should be able to see the Access and Secret access key settings.

Then, create the new access key and the secret access key. Also, download the key file.

Launch, the following command to configure AWS CLI and enter the information

aws configure

In case, of mistakes, you can always change it by modifying the config and credential files which are located inside the .aws hidden folder in the $HOME directory

The default output format specifies how the results are formatted. Values that can be used here include:

  • json
  • text
  • table

The region depends on which region you want to deploy your servers. Please refer to the official Amazon region guide.

5. You can test if you properly configure everything by querying your identity as follows:

aws sts get-caller-identity

Enabling AWS CLI auto-completion

6. To enable auto-completion on Rocky Linux, first locate where is the “aws_completer” script. In my case, it’s in the home directory

[tunnelix@awslab ~]$ which aws_completer
~/.local/bin/aws_completer

[tunnelix@awslab ~]$ pwd
/home/tunnelix

7. Since my shell environment is /bin/bash, I have exported the binary to the profile using the following command:

export PATH=/home/tunnelix/.local/bin/:$PATH
source ~/.bash_profile 

8. Then use the Complete command to specify how arguments are to be completed in Readline:

complete -C '/home/tunnelix/.local/bin/aws_completer' aws

9. I can now perform auto-completion using the aws command

[tunnelix@awslab ~]$ aws cli sTAB

If you have a different Shell environment consider looking at the AWS shell auto-completion link.

Nitin J Mutkawoa https://tunnelix.com

Blogger at tunnelix.com | Founding member of cyberstorm.mu | An Aficionado Journey in Opensource & Linux – And now It's a NASDAQ touch!

You May Also Like

More From Author