Goglides Dev 🌱

Balkrishna Pandey
Balkrishna Pandey

Posted on

Install aws cli without root

To install the AWS CLI (Command Line Interface) on a Linux system without root access, you need to install it in a directory where you have write permissions and adjust your PATH environment variable to include the directory where the AWS CLI executables are located. Below are the simplified instructions to do so:

#!/bin/bash

# Set the installation and binary directory paths
INSTALL_DIR="$HOME/aws-cli"
BIN_DIR="$HOME/bin"

# Download the AWS CLI v2
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"

# Unzip the AWS CLI v2 installer
unzip awscliv2.zip

# Create the binary directory if it doesn't exist
mkdir -p "$BIN_DIR"

# Install the AWS CLI v2 to the specified directories
./aws/install -i "$INSTALL_DIR" -b "$BIN_DIR"

# Add the binary directory to PATH variable
echo "export PATH=$BIN_DIR:\$PATH" >> "$HOME/.bashrc"

# Reload the .bashrc file to update PATH for the current session
source "$HOME/.bashrc"

# Verify the installation
aws --version
Enter fullscreen mode Exit fullscreen mode

Top comments (0)