Backup and restore files from the working directory to an Amazon AWS S3 bucket. Supports both, iOS Pythonista and Desktop Linux/Mac OS.
When run within iOS Pythonista, a native ui allows action/command selection. Linux/Mac OS display is limited to the terminal/console.
I use this to share/sync code between my iPhone, iPad, and Mac laptop.
By default, the script backups the following locations:
- Pythonista:
- Files downloaded to and restored from the
~/Documents
directory.
- Files downloaded to and restored from the
- Linux/mac os:
- Files downloaded to and restored from the working directory, not the directory containing the script.
- Example: Run
python s3sync.py [ACTION]
ACTION
: Optional, any of the commands displayed when the script is run.
- A JSON configuration file
s3sync.conf
can be used to store configurations. - If missing, the script will prompt for information each time it is run.
- See
s3sync.sample.conf
for a full list of options. JSON Schema is used for its schema documentation.
- Copy
s3sync.sample.conf
to the same directory as thes3sync.py
script and rename tos3sync.conf
- Update config file as appropriate.
- Since the script uses the AWS boto library, it supports all of the authentication methods boto does:
- Environment variables, AWS Credentials, AWS Config, boto2 or boto3 configuration.
- See AWS boto3 Credentials Docs for more details
- If you would like to manage the authentication configuration separately, you can add AWS credentials to
s3sync.conf
.
- Download or clone the github repo, or:
- Pythonista console:
import urllib2; exec urllib2.urlopen('http://khl.io/s3sync-py').read()
- Linux/Mac OS Terminal:
python -c "import urllib2; exec urllib2.urlopen('http://khl.io/s3sync-py').read()"
- Pythonista console: