openec2 Article Description

(Note: if using on a cPanel service, search for python3.8, and use that full directory path in the python command below.
I typically make an aws directory )

If you wish to access S3 buckets from Debian outside of Amazon’s EC2 Linux 2023, you install the aws command.
An example of use:
aws s3 ls s3://MY_BUCKET/
aws s3 mv FILE s3://MY_BUCKET/FILE
aws s3 mv s3://MY_BUCKET/FILE FILE
and so on.

There is a previous article showing how you set up ~.aws/config.
Once aws in installed, you run the command “aws configure”, pressing the. Return Key at each prompt. Then you can check your s3 ls command.

aws is not useful with certain VPN IP addresses. It seems to be at random which one fail or work

I use aws in a script to backup database files each week from crontab, and WordPress directories once a month – this sort of thing.

Version 2 of the AWS CLI is not working – I have no knowledge of a fix or corrected method to make it work. This applies to Debian or to Linux on cPanel services.

First, we usually use Python 3.8 to install. The previous certbot installation of python does not work. So….

cd /home/ec2-user
apt install python
[You likely see a message of what to install after this...]
apt install python-is-python3 2to3

[You may not need the following, but can install if needed]
apt install groff less

[I suspect as glibc is missing from Debian, this may prevent the installation of aws cli v2. I am reluctant to get into lots of packages around libc, but you can reference it here and experiment:
https://packages.debian.org/source/bullseye/glibc
A search on Amazon AWS CLI will show the installation steps for x86 or ARM Linux.]

[The V1 install:]

curl "https://s3.amazonaws.com/aws-cli/awscli-bundle.zip" -o "awscli-bundle.zip"
unzip awscli-bundle.zip
python ./awscli-bundle/install -i /usr/local/aws -b /usr/local/bin/aws

aws --version

You can now make sure ~.aws/config file is in place:

cd ~
mkdir .aws
chmod 2775 .aws
cd .aws
vi config
[default]
region=ap-southeast-2
aws_access_key_id=YOUR_IAM_S3_BUCKETS_KEY
aws_secret_access_key=YOUR_IAM_S3_BUCKETS_SECRET_KEY


[save and exit with two blank lines below the last aws_secret line]

[The keys were made in a previous article when setting up AWS services]

aws configure

[Press the RETURN key at each prompt]

aws --version
aws ls s3://YOUR_BUCKET/