What is AWS CLI

Many companies now use Amazon Web Services to deploy and manage their applications. According to Amazon, there are over 1,000,000 users who use their services. There are some new emerging technologies like DevOps and cloud computing that push organizations to use AWS services. AWS provides AWS CLI, which helps developers access all the services using less time. It increases efficiency and removes all the hurdles users faced earlier. They had to follow many complex steps, making them take more time, and in the end, some even became unsuccessful. The elimination of these steps has been successful with the launch of AWS CLI.

What is AWS CLI?

AWS CLI is an AWS tool developers use to monitor and manage AWS services in one place. You control the client's sessions using the command line. You just download and perform several configurations that enable you to control the AWS services.It also customizes several AWS APIs that provide direct access. It improves automation and makes it easier to control the environment.It works with all the operating systems, i.e., Linux, Mac, and Windows. There are several ways you use the tool on different terminals, as below:

Linux shell-You use different shell programs like bash and zsh. They make users run different commands in all the operating systems.

Window Command line-It enables you to run different commands on the Windows operating system using PowerShell or Command Prompt.

Remotely. Several remote terminals like SSH and PuTTY enable users to run commands for different Amazon instances and help automate tasks on the AWS services.

  Become a AWS Certified professional by learning this HKR AWS Training !

How does AWS CLI work?

AWS services provide databases and content delivery. They also provide computing power and infrastructure for application and service deployment. They have cheaper pricing, good customer service, are swift, and have many advantages.

AWS CLI combines all the services and functions in one place, giving you the power to control and manage them. It improves the interaction with the system.

How to install AWS CLI?

There are several ways of installing AWS CLI. The common installation methods are pip, virtual environment, e.t.c.

Installing AWS CLI using Python pip(For AWS CLI (version 1)

Prerequisites

Computer with an operating system of your choice.

Python on your PC.

1. The first step is to install Python for those who haven't installed Python yet. Visit the Python website, select the latest version, and choose your operating system. Download it and run the executable file.

2. Install pip by typing  pip3 install awscli --upgrade --user on the command line to have the updated version of AWS CLI. If you want to use a particular version of AWS CLI, you type the command below: 

pip3 install awscli<1.16.312 --upgrade="" --user="" p="">

3. Now you have to confirm the installation by typing the command below: aws --version, and it will show a result like this aws-cli/1.22.23 Python/3.10.4 Windows/10 botocore/1.13.

4. Now you have to add AWS CLI to the path of your operating system. Go to the Command Prompt for Windows and type where aws.

5. The path will show up according to the installation method and the platform type. For example 

C:\Program Files\Amazon\AWSCLI\bin\aws.exe

C:\Program Files\Python38\Scripts\ and C:\Program Files\Amazon\AWSCLI\bin e.t.c.

6. Go to the start of your Windows start button and search for environment variables.

7. Click on the Edit environment variables for your account.

Select PATH and choose the Edit option.

9. Under the Variable value, type the path you want to add, for example, C:\Program Files\Python38\Scripts\ and click the Apply and OK buttons, respectively.

10. Exit the command prompt and restart your PC. You are good at using AWS CLI

AWS Training

Master Your Craft   Lifetime LMS & Faculty Access    24/7 online expert support

Real-world & Project Based Learning

                                                    Explore Curriculum

Installing AWS CLI using bundle master

1. Use curl command to download the bundle master curl"https://s3.amazonaws.com/aws-cli/awscli-bundle.zip" -o "awscli-bundle.zip"

2. To specify a particular version for the bundle master, you use the command below:

curl"https://s3.amazonaws.com/aws-cli/awscli-bundle-1.17.312.zip" -o "awscli-bundle.zip"

3. You also install it directly from 

4. Unzip the files from the bundle using the unzip Linux command
unzip awscli-bundle.zip

5. Locate the zipped file and run the installer; you will find it in the /usr/local/aws. You will find a symlink when you open /usr/local/bin directory.

6. You can also use a -b option that creates a symlink without asking for the location of the installation directory as follows

sudo ./awscli-bundle/install -i /usr/local/aws -b /usr/local/bin/aws

7. If you didn't use the default Python, you use the command below to install AWS CLI in the right path.

sudo /usr/local/bin/python3.7 awscli-bundle/install -i /usr/local/aws -b /usr/local/bin/aws

8. Confirm the installation 

 aws --version

Installing AWS CLI using a Virtual environment

1. Ensure you have installed Python and pip on your machine.

2. Type the command below to install virtual environment.
pip install --user virtualenv

3. Create and name the virtual environment

 virtualenv ~/sample

4. Let us now activate the virtual environment depending on the operating system.

For Linux and MacOs  source ~/sample/bin/activate

For Windows  %USERPROFILE%\csample\Scripts\activate

5. Type the command below to install AWS CLI (sample)~ pip install --upgrade awscli

6. Confirm the installation 

aws --version

7. There are options where you can activate and deactivate the virtual environment.

Installing AWS CLI Version 2 on Linux, Windows, and MacOs 

Windows Operating System

1. Visit the website to download the MSI installer. Double click to run the installer or use the Command Prompt by typing msiexec.exe /i MSI to run the MSI installer.

2. Confirm the AWS installation using aws --version command.

Linux Operating System

Linux x86

1. Download the installation file using the command below, and the -0 identifies the file name the downloaded package gets written to.

curl"https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"

2. Others can download it directly from 

3. Unzip the downloaded file using the unzip command as follows:
unzip awscliv2.zip

4. Locate the file and install it to the default folder /usr/local/aws-cli, which automatically creates a symlink in /usr/local/bin directory. If you want to grant and change permission, use the following formula sudo ./aws/install.

5. Ensure successful installation using the command below
aws --version

After downloading the zipped file manually, they want to find its integrity. You do that by following the steps below:

1. Download the GnuPG tool from its website.

2. Create a public key using notepad or any editor to create a text file.

3. Import your AWS CLI public key using gdp

gpg --import yourkey

4. Download your signature file, most of them end with .sig extension
curl -o awscliv2.sig 

5. Confirm the files
gpg --verify awscliv2.sig awscliv2.zip

 Want to know more abou AWS, visit here AWS tutorial !

Subscribe to our youtube channel to get new updates..!

macOS operating system

Using GUI installer

1. Go to your browser and visit their website to download the pkg setup.

2. Run the pkg file and install it. To install for all the users, ensure you have sudo. Developers can use the default folder /usr/local/aws-cli during installation or choose your preferred folder. When using this option, there is the automatic creation of a symlink at the /usr/local/bin/aws folder that links the installation program to the main program.

3. When you want to install it for the current user, it does not require sudo. Select any folder that enables you to change its permission. After installation, you use the commands below to help you in the creation of the symlink file.
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

4. Use the command below to ensure the installation is successful.
 which aws

 aws --version

5. If there is no AWS CLI, you have to restart the terminal.

Uses of AWS CLI

There are several uses of AWS CLI. Some of the common reasons why to use AWS CLI include:

  • Easy Installation. The old methods took a lot of time when managing the AWS services. AWS CLI eliminated all the long processes making it work in several environments. It also made installation easier as it was fast and straightforward to follow.
  • Automates Processes. It enables developers to automate most of the processes that involve manual handling. You can automate through the use of scripts and commands.
  • Supports all Amazon Web Service. There are over 40 + Amazon Web Services. Initially, developers had issues controlling all the services with one click. AWS CLI changed that, and developers can access all the AWS services using the tool.
  • Less time. The AWS Management Console has many services that can make users spend more time looking for the best tool. AWS CLI came with several commands that one can use to perform multiple functions, saving a lot of time.

Top 50+ frequently asked AWS interview questions !

AWS Training

Weekday / Weekend Batches

Conclusion

AWS CLI has automated all the processes that used to waste time. It has helped improve developers' productivity and ensure there are faster project releases. If you are a developer or engineer, learning how to use AWS CLI will boost many things allowing you to be better than the use of earlier AWS tools.

Related Article:

Find our upcoming AWS Training Online Classes

  • Batch starts on 12th Aug 2022, Fast Track batch

  • Batch starts on 16th Aug 2022, Weekday batch

  • Batch starts on 20th Aug 2022, Weekend batch

Global Promotional Image
 

Categories

Request for more information

Ishan Gaba
Ishan Gaba
Research Analyst
Ishan is an IT graduate who has always been passionate about writing and storytelling. He is a tech-savvy and literary fanatic since his college days. Proficient in Data Science, Cloud Computing, and DevOps he is looking forward to spreading his words to the maximum audience to make them feel the adrenaline he feels when he pens down about the technological advancements. Apart from being tech-savvy and writing technical blogs, he is an entertainment writer, a blogger, and a traveler.

CLI means command-line interface

AWS CLI uses the Python programming language.

The main advantages of using CLI are that it promotes productivity, saves time, promotes automation, and supports all the AWS services.

AWS CLI makes the management of AWS services easier and faster.