A simple backup and restore process which supports SSE encryption for S3 object storage :)
- python3
- pip
- boto3
- dotenv
# install python and pip (debian/ubuntu)
sudo apt install python3 python-pip -y
# install pip modules
pip install boto3 python-dotenv
# Note: Your encryption key must be 32 characters
openssl rand -hex 16
# AWS settings
AWS_ACCESS_KEY_ID="example-access-key"
AWS_SECRET_ACCESS_KEY="example-secret-access-key"
AWS_BUCKET_ENDPOINT="https://example-cluster-url"
AWS_BUCKET_FOLDER="Backups"
# SSE settings
SSE_ENCRYPTION_KEY="example-encryption-key-987654321"
SSE_ENCRYPTION_ALGO="AES256"
# send a file backup to remote S3 bucket
python3 s3-sse-backup.py send ~/Pictures/gravatar.jpg
# restore the sent file backup to local
python3 s3-sse-backup.py restore gravatar.jpg
- The process only allows sending or restoring one file at a time.
- The process doesn't support sending files while retaining nested folder structure. (Files are stored in a single folder as specified in
.env
file) - The process to restore file cannot start with a path name.