Tech Monger

Programming, Web Development and Computer Science.

Skip to main content| Skip to information by topic

How to Install AWS CLI in Linux

While working with Amazon Web Services (AWS) it is essential to have command line utility installed on the machine to perform the administration or development activities. Below we will find steps for the AWS CLI Installation on Linux.


AWS CLI Installation Steps

  • Download the AWS CLI binary zip file awscli-exe-linux-x86_64.zip from the AWS website.

    curl https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip
  • Login as root user on the Linux machine to perform the installation.

    sudo su - root

  • Create directory where you want to extract above zip file.

    mkdir /path/to/extract/binaries
  • Extract binaries with following command.

    cd /path/to/extract/binaries
    unzip awscli-exe-linux-x86_64.zip

  • Execute following command from the current working directory to perform the installation.

    sudo ./aws/install
    
    If you try to install binaries without root user then you would get following error.

    mkdir: cannot create directory ‘/usr/local/aws-cli’: Permission denied

  • AWS CLI will get installed inside default directory /usr/local/aws-cli.

  • AWS CLI may not be accessible to all users due to insufficient permissions. If you get below error while running aws cli despite of having /usr/local/ in user PATH then use below command to grant RWX to AWS CLI Binaries to let non root user access it.

    aws: command not found

    chmod -R 777 /usr/local/aws-cli/

  • Confirm the installation by checking version.

    aws --version
    aws-cli/2.0.28 Python/3.7.3 Linux/3.10.0-1127.el7.x86_64 botocore/2.0.0dev32
    

  • Conclusion

    We learned how to install AWS CLI in Linux Machine. These steps will be common for all Linux distros like RHEL, Fedora, Ubuntu, Debian, Raspbian etc.

    Tagged Under : Linux Open Source Ubuntu