It's a simple python commandline script for archiving a folder and upload it to the s3.
- Python3.8+
- Poetry
- Pip (optional)
poetry install
AWS_SHARED_CREDENTIALS_FILE=~/.aws/credentials \
AWS_PROFILE=profile.dev \
poetry run backup_to_s3 \
-i ~/backup-folder/
-s s3://your-bucket/backup/folder/name
For achieving this, we have to use poetry build
to generate a tar file for pip install
.
The detail steps can be found as following:
cd backup-to-s3/
poetry build
The built tar.gz
should be put under backup-to-s3/dist
.
pip install backup-to-s3/dist/backup-to-s3.xxx.tar.gz
AWS_SHARED_CREDENTIALS_FILE=~/.aws/credentials \
AWS_PROFILE=profile.dev \
backup_to_s3 \
-i ~/backup-folder/
-s s3://your-bucket/backup/folder/name