DEV Community

JPL
JPL

Posted on • Updated on

Install the AWS CLI v2

CLI - Command Line Interface is very very useful in the world of DevOps. For the Windows users swipe from Windows to Linux is one of major steps to learn CLI and use it every day in the tasks, projects and personal configuration.

Benefits of AWS CLI are:

  • EFFICIENCY

  • REMOTE ACCESS (very often DevOps need to access remote services in AWS, which is more faster than do it manually)

  • TROUBLESHOOTING (in less time is possible checking problems with network, ports..)

  • EASY INSTALLATION (steps are below)

  • SAVES TIME

  • AUTOMATE PROCESSES

  • SUPPORTS ALL AMAZON WEB SERVICES (s3, ec2, iam ..)

AWS CLI provides direct access to AWS services public APIs, a lot of work can be done only through AWS CLI but with a less effort.

To update your current installation of AWS CLI, download a new installer each time you update to overwrite previous versions.

    curl "https://awscli.amazonaws.com/awscli-exe-linux- 
    x86_64.zip" -o "awscliv2.zip"
    unzip awscliv2.zip
    sudo ./aws/install
Enter fullscreen mode Exit fullscreen mode

curl-cli-v2

To update your current installation of the AWS CLI, add your existing symlink and installer information to construct the install command with the --update parameter.

   sudo ./aws/install --bin-dir /usr/local/bin --install-dir /usr/local/aws-cli --update
Enter fullscreen mode Exit fullscreen mode

UNZIP INSTALLER

    unzip awscliv2.zip
Enter fullscreen mode Exit fullscreen mode

unzip-cli

RUN THE INSTALL PROGRAM

Run the install program. The installation command uses a file named install in the newly unzipped aws directory. By default, the files are all installed to /usr/local/aws-cli, and a symbolic link is created in /usr/local/bin. The command includes sudo to grant write permissions to those directories.

    sudo ./aws/install
Enter fullscreen mode Exit fullscreen mode

CONFIRM INSTALLATION

    aws --version
Enter fullscreen mode Exit fullscreen mode

sudo-aws-version-cli

How to check does user have configured profile on laptop?

   aws configure list-profiles
Enter fullscreen mode Exit fullscreen mode

If you don't have it, then you need to setup using command aws configure.

TESTING configuration:

   aws s3 ls 
Enter fullscreen mode Exit fullscreen mode

If you get list of your buckets, then your CLI is configured correctly.

HOW TO CHECK which account of AWS is connected on our CLI?

One of the useful command to check this is:

   $ aws sts get-caller-identity 
Enter fullscreen mode Exit fullscreen mode

Image description

Source for install CLI v2 : AWS Documentation

Source for check the profiles and setup more profiles on AWS Documentation

Top comments (0)