Installing AWS-CLI v2 on Raspberry Pi 4

How to install AWS CLI version 2 on Raspberry Pi 4"

The version of aws-cli that’s available via apt on Raspberry Pi OS is 1.16, as Amazon says version 1 is old, and is not getting new features.

Their install instructions have a version for ARM, but it’s for aarch64, not armhf, so their instructions don’t work on our rpi. So here’s what you need to do to install the latest stable version on your pi.

  1. Clone the repo from Github
  2. Checkout the v2 branch
  3. Install locally.

Pre-requisites

You’ll need git, and pip.

sudo apt-get install git python3-pip cmake 

Get AWS CLI Source and install it for your local user

git clone [email protected]:aws/aws-cli.git
cd aws-cli
git checkout v2
pip3 install -r requirements.txt --upgrade --user 
pip3 install . --upgrade --user 
export PATH=/home/pi/.local/bin:$PATH

Be sure to add

export PATH=/home/pi/.local/bin:$PATH

to your .zshrc or .profile. This install is local to the pi user only.

Make sure you have your AWS Credentials handy, if you do not Go to the AWS Management Console and create a new user or generate new credentials.

  ~ aws --version
aws-cli/2.2.6 Python/3.7.3 Linux/5.10.17-v7l+ source/armv7l.raspbian.10 prompt/off
  ~
  ~ aws configure
AWS Access Key ID [None]: AKIAIOSFODNN7EXAMPLE
AWS Secret Access Key []: wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
Default region name [None]: us-east-2 (or whatever your preference is)
Default output format [None]:
  ~
  ~ aws s3 mb s3://my-unique-bucket-05262021
make_bucket: my-unique-bucket-05262021
  ~ aws s3 ls
2021-03-18 16:26:10 my-unique-bucket-05262021 
XXXX-XX-XX XX:XX:XX other-buckets
  ~