Instructions for installing AWS CLI on a Server

0

I want to be able to install AWS on my server from my remote terminal and run it from the server. currently AWS is installed on my local machine and after configuring it, I succeeded in transferring my data to AWS S3. But now I have some data on an on premise linux server that I want to transfer to AWS S3. When I tried that using SSH. It tells me that aws is not found on the server. So how do I install it on my server. The instruction provided in the manual is only for local installation

4 Answers
2

For Linux server:

  sudo apt install awscli

To install AWS CLI on Linux using PIP:

 python3 -m pip install awscli

Or

 python3 -m pip install awscliv2

 awscliv2 --install

 which aws

Add this path(output of previous step) to your PATH environment variable

========>> Edit:

For Ubuntu server:

Go to EC2 instance from console -> Actions -> Connect -> EC2 Instance Connect

 sudo apt update
 sudo apt install python3-pip
 sudo python3 -m pip install awscli

aws cli would be installed at '/home/ubuntu/.local/bin'. Either add this path to your PATH variable or create a symlink as below:

cd /usr/local/bin
sudo ln -s /home/ubuntu/.local/bin/aws ./

Now you can run aws cli on the sever.

For Windows server:

Download AWS CLI MSI Installer and install it.

If you have any questions, refer Install or update the latest version of the AWS CLI

profile pictureAWS
EXPERT
answered 9 months ago
  • Thanks. When I run the above command, it installs it on my local machine. I want to install it on a remote server

  • I assume this is EC2 linux. Can you ssh to that server? if so, then ssh to that server and then install using above command. Or go to AWS management console, go to EC2 and click your instance, go to Actions and then Connect. Using above mentioned command, install it. Let me know if you have any questions.

  • If you intend to run all commands from your local machine to remote EC2 server, I'd suggest you to start looking at SSM. Here is step by step guide for that too, if you find that can help.

  • Let me take a look at mine.

  • I installed at mine(Ubuntu ec2) and instructions that I mentioned for ubuntu worked fine. Can you tell me the AMI id which you'd have used while creating ubuntu EC2.

    You need to follow these steps to install awscli on ubuntu ec2:

    sudo apt update sudo apt install python3-pip sudo python3 -m pip install awscli

    Let me know how it goes. If this helped then you may accept the answer, if not happy to help further.

0

After you SSH into the server, refer to Install or update the latest version of the AWS CLI for instructions.

AWS
EXPERT
Mike_L
answered 9 months ago
0

No package awscli available

Benneth
answered 9 months ago
  • I installed at mine(Ubuntu ec2) and instructions that I mentioned for ubuntu worked fine. Can you tell me the AMI id which you'd have used while creating ubuntu EC2.

    You need to follow these steps to install awscli on ubuntu ec2:

    sudo apt update sudo apt install python3-pip sudo python3 -m pip install awscli

    Let me know how it goes. If this helped then you may accept the answer, if not happy to help further.

0

When I ran the command from the root of the server, it gave me the following error "apt: invalid flag: install"

Benneth
answered 9 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions